Module Name: src Committed By: rillig Date: Sun Oct 17 17:20:47 UTC 2021
Modified Files: src/tests/usr.bin/indent: opt_badp.c t_options.sh Log Message: tests/indent: remove redundant test output for -nbap To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/opt_badp.c \ src/tests/usr.bin/indent/t_options.sh 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_badp.c diff -u src/tests/usr.bin/indent/opt_badp.c:1.2 src/tests/usr.bin/indent/opt_badp.c:1.3 --- src/tests/usr.bin/indent/opt_badp.c:1.2 Sat Oct 16 09:39:21 2021 +++ src/tests/usr.bin/indent/opt_badp.c Sun Oct 17 17:20:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opt_badp.c,v 1.2 2021/10/16 09:39:21 rillig Exp $ */ +/* $NetBSD: opt_badp.c,v 1.3 2021/10/17 17:20:47 rillig Exp $ */ /* $FreeBSD$ */ /* @@ -76,35 +76,4 @@ declaration_with_several_blank_lines(voi } #indent end -#indent run -nbadp -static void -no_declarations(void) -{ - action(); -} - -static void -declarations_without_blank_line(void) -{ - int local_variable; - action(); -} - -static void -declaration_with_blank_line(void) -{ - int local_variable; - - action(); -} - -static void -declaration_with_several_blank_lines(void) -{ - int local_variable; - - - - action(); -} -#indent end +#indent run-identity -nbadp -ldi0 Index: src/tests/usr.bin/indent/t_options.sh diff -u src/tests/usr.bin/indent/t_options.sh:1.2 src/tests/usr.bin/indent/t_options.sh:1.3 --- src/tests/usr.bin/indent/t_options.sh:1.2 Sat Oct 16 05:40:17 2021 +++ src/tests/usr.bin/indent/t_options.sh Sun Oct 17 17:20:47 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_options.sh,v 1.2 2021/10/16 05:40:17 rillig Exp $ +# $NetBSD: t_options.sh,v 1.3 2021/10/17 17:20:47 rillig Exp $ # # Copyright (c) 2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -39,13 +39,18 @@ # #indent run [options] # Runs indent on the input, using the given options. # #indent end [description] -# Finishes an 'input' or 'run' section. +# Finishes an '#indent input' or '#indent run' section. +# #indent run-identity [options] +# Runs indent on the input, expecting unmodified output. # # All text between these directives is not passed to indent. srcdir=$(atf_get_srcdir) indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent) +# Read the test specification from stdin, output the actual test output on +# stdout, write the expected test output to 'expected.out'. +# # shellcheck disable=SC2016 check_awk=' function die(msg) @@ -66,6 +71,8 @@ function die(msg) /^#/ && $1 == "#indent" { print $0 + print $0 > "expected.out" + if ($2 == "input") { if (unused != 0) die(FILENAME ":" unused ": input is not used") @@ -74,6 +81,7 @@ function die(msg) prev_input_all = input_all input_all = "" unused = NR + } else if ($2 == "run") { mode = "run" cmd = ENVIRON["INDENT"] @@ -83,6 +91,7 @@ function die(msg) print in_lines[i] | cmd close(cmd) unused = 0 + } else if ($2 == "run-identity") { cmd = ENVIRON["INDENT"] for (i = 3; i <= NF; i++) @@ -93,14 +102,16 @@ function die(msg) } close(cmd) unused = 0 + } else if ($2 == "end") { if (mode == "input" && input_all == prev_input_all) die(FILENAME ":" NR ": error: duplicate input") mode = "" + } else { die(FILENAME ":" NR ": error: invalid line \"" $0 "\"") } - print $0 > "expected.out" + next }