Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/indent tests/indent: strengthen requirements f...



details:   https://anonhg.NetBSD.org/src/rev/3d0a9de873cb
branches:  trunk
changeset: 376630:3d0a9de873cb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jun 26 12:21:18 2023 +0000

description:
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.

diffstat:

 tests/usr.bin/indent/opt_dj.c      |  6 +++---
 tests/usr.bin/indent/t_options.lua |  8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 1af4933b9e98 -r 3d0a9de873cb tests/usr.bin/indent/opt_dj.c
--- a/tests/usr.bin/indent/opt_dj.c     Mon Jun 26 11:01:08 2023 +0000
+++ b/tests/usr.bin/indent/opt_dj.c     Mon Jun 26 12:21:18 2023 +0000
@@ -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,9 +108,9 @@ struct a {
 };
 //indent end
 
-//indent run-equals-input -di0
+//indent run-equals-prev-output -dj
 
-//indent run-equals-prev-output -dj
+//indent run-equals-input -di0
 
 
 //indent input
diff -r 1af4933b9e98 -r 3d0a9de873cb tests/usr.bin/indent/t_options.lua
--- a/tests/usr.bin/indent/t_options.lua        Mon Jun 26 11:01:08 2023 +0000
+++ b/tests/usr.bin/indent/t_options.lua        Mon Jun 26 12:21:18 2023 +0000
@@ -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)



Home | Main Index | Thread Index | Old Index