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: reorder code in test driver



details:   https://anonhg.NetBSD.org/src/rev/7f81b3630efa
branches:  trunk
changeset: 1026313:7f81b3630efa
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Nov 18 17:11:13 2021 +0000

description:
tests/indent: reorder code in test driver

No functional change.

diffstat:

 tests/usr.bin/indent/t_options.awk |  58 +++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 29 deletions(-)

diffs (87 lines):

diff -r a03e4653d662 -r 7f81b3630efa tests/usr.bin/indent/t_options.awk
--- a/tests/usr.bin/indent/t_options.awk        Thu Nov 18 16:54:34 2021 +0000
+++ b/tests/usr.bin/indent/t_options.awk        Thu Nov 18 17:11:13 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_options.awk,v 1.2 2021/10/23 20:35:18 rillig Exp $
+# $NetBSD: t_options.awk,v 1.3 2021/11/18 17:11:13 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -46,9 +46,26 @@
 #              the previous run.
 #
 # All text outside these directives is not passed to indent.
+#
+# The actual output from running indent is written to stdout, the expected
+# test output is written to 'expected.out'.
 
-# Read the test specification from stdin, output the actual test output on
-# stdout, write the expected test output to 'expected.out'.
+BEGIN {
+       warned = 0
+       died = 0
+
+       section = ""            # "", "input" or "run"
+       section_excl_comm = ""  # without dollar comments
+       section_incl_comm = ""  # with dollar comments
+
+       input_excl_comm = ""    # stdin for indent
+       input_incl_comm = ""    # used for duplicate checks
+       unused_input_lineno = 0
+
+       output_excl_comm = ""   # expected output
+       output_incl_comm = ""   # used for duplicate checks
+       output_lineno = 0
+}
 
 function die(lineno, msg)
 {
@@ -70,32 +87,6 @@
        return "'" s "'"
 }
 
-BEGIN {
-       warned = 0
-       died = 0
-
-       section = ""            # "", "input" or "run"
-       section_excl_comm = ""  # without dollar comments
-       section_incl_comm = ""  # with dollar comments
-
-       input_excl_comm = ""    # stdin for indent
-       input_incl_comm = ""    # used for duplicate checks
-       unused_input_lineno = 0
-
-       output_excl_comm = ""   # expected output
-       output_incl_comm = ""   # used for duplicate checks
-       output_lineno = 0
-}
-
-# Hide comments starting with dollar from indent; they are used for marking
-# bugs and adding other remarks directly in the input or output sections.
-/^[[:space:]]*\/[*][[:space:]]*[$].*[*]\/$/ ||
-    /^[[:space:]]*\/\/[[:space:]]*[$]/ {
-       if (section != "")
-               section_incl_comm = section_incl_comm $0 "\n"
-       next
-}
-
 function check_unused_input()
 {
        if (unused_input_lineno != 0)
@@ -113,6 +104,15 @@
        close(cmd)
 }
 
+# Hide comments starting with dollar from indent; they are used for marking
+# bugs and adding other remarks directly in the input or output sections.
+/^[[:space:]]*\/[*][[:space:]]*[$].*[*]\/$/ ||
+/^[[:space:]]*\/\/[[:space:]]*[$]/ {
+       if (section != "")
+               section_incl_comm = section_incl_comm $0 "\n"
+       next
+}
+
 /^#/ && $1 == "#indent" {
        print $0
        print $0 > "expected.out"



Home | Main Index | Thread Index | Old Index