Module Name: src
Committed By: rillig
Date: Mon Jun 26 12:21:18 UTC 2023
Modified Files:
src/tests/usr.bin/indent: opt_dj.c t_options.lua
Log Message:
tests/indent: strengthen requirements for test input files
Previously, 'indent run-equals-prev-output' was allowed even when there
was no 'indent run' section above. This created an ambiguity, since
'previous output' could mean either the 'indent run' section or the
'indent run-equals-input' section.
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/indent/opt_dj.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/indent/t_options.lua
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/indent/opt_dj.c
diff -u src/tests/usr.bin/indent/opt_dj.c:1.8 src/tests/usr.bin/indent/opt_dj.c:1.9
--- src/tests/usr.bin/indent/opt_dj.c:1.8 Mon Jun 5 15:02:54 2023
+++ src/tests/usr.bin/indent/opt_dj.c Mon Jun 26 12:21:18 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_dj.c,v 1.8 2023/06/05 15:02:54 rillig Exp $ */
+/* $NetBSD: opt_dj.c,v 1.9 2023/06/26 12:21:18 rillig Exp $ */
/*
* Tests for the options '-dj' and '-ndj'.
@@ -108,10 +108,10 @@ struct a {
};
//indent end
-//indent run-equals-input -di0
-
//indent run-equals-prev-output -dj
+//indent run-equals-input -di0
+
//indent input
{
Index: src/tests/usr.bin/indent/t_options.lua
diff -u src/tests/usr.bin/indent/t_options.lua:1.6 src/tests/usr.bin/indent/t_options.lua:1.7
--- src/tests/usr.bin/indent/t_options.lua:1.6 Fri Jun 16 23:19:01 2023
+++ src/tests/usr.bin/indent/t_options.lua Mon Jun 26 12:21:18 2023
@@ -1,4 +1,4 @@
--- $NetBSD: t_options.lua,v 1.6 2023/06/16 23:19:01 rillig Exp $
+-- $NetBSD: t_options.lua,v 1.7 2023/06/26 12:21:18 rillig Exp $
--
-- Copyright (c) 2023 The NetBSD Foundation, Inc.
-- All rights reserved.
@@ -199,9 +199,15 @@ local function handle_indent_run_equals_
expected_out:write(input_excl_comm)
unused_input_lineno = 0
max_empty_lines = 0
+ output_incl_comm = ""
+ output_excl_comm = ""
end
local function handle_indent_run_equals_prev_output(args)
+ if output_incl_comm == "" then
+ warn(lineno,
+ "no previous output; use run-equals-input instead")
+ end
check_empty_lines_block(1)
run_indent(input_excl_comm, args)
expected_out:write(output_excl_comm)