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: remove redundant test out...
details: https://anonhg.NetBSD.org/src/rev/5a15c6b39b67
branches: trunk
changeset: 989867:5a15c6b39b67
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Oct 17 17:20:47 2021 +0000
description:
tests/indent: remove redundant test output for -nbap
diffstat:
tests/usr.bin/indent/opt_badp.c | 35 ++---------------------------------
tests/usr.bin/indent/t_options.sh | 17 ++++++++++++++---
2 files changed, 16 insertions(+), 36 deletions(-)
diffs (119 lines):
diff -r c0f15fb0d9f6 -r 5a15c6b39b67 tests/usr.bin/indent/opt_badp.c
--- a/tests/usr.bin/indent/opt_badp.c Sun Oct 17 14:45:45 2021 +0000
+++ b/tests/usr.bin/indent/opt_badp.c Sun Oct 17 17:20:47 2021 +0000
@@ -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 @@
}
#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
diff -r c0f15fb0d9f6 -r 5a15c6b39b67 tests/usr.bin/indent/t_options.sh
--- a/tests/usr.bin/indent/t_options.sh Sun Oct 17 14:45:45 2021 +0000
+++ b/tests/usr.bin/indent/t_options.sh Sun Oct 17 17:20:47 2021 +0000
@@ -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 @@
/^#/ && $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 @@
prev_input_all = input_all
input_all = ""
unused = NR
+
} else if ($2 == "run") {
mode = "run"
cmd = ENVIRON["INDENT"]
@@ -83,6 +91,7 @@
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 @@
}
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
}
Home |
Main Index |
Thread Index |
Old Index