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: make add-test generate fl...



details:   https://anonhg.NetBSD.org/src/rev/cf7f5db1e7b2
branches:  trunk
changeset: 989902:cf7f5db1e7b2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Oct 19 19:59:05 2021 +0000

description:
tests/indent: make add-test generate flexible tests

They need fewer source files and are more versatile.

diffstat:

 tests/usr.bin/indent/Makefile |  31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diffs (58 lines):

diff -r 12d6666e95f4 -r cf7f5db1e7b2 tests/usr.bin/indent/Makefile
--- a/tests/usr.bin/indent/Makefile     Tue Oct 19 18:29:59 2021 +0000
+++ b/tests/usr.bin/indent/Makefile     Tue Oct 19 19:59:05 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.22 2021/10/18 23:01:10 rillig Exp $
+#      $NetBSD: Makefile,v 1.23 2021/10/19 19:59:05 rillig Exp $
 
 .include <bsd.own.mk>
 
@@ -185,11 +185,11 @@
 
 add-test: .PHONY
        @set -eu; \
-       test=${NAME:Q}; \
-       [ "$$test" ] || { \
+       test=${NAME:Q}.c; \
+       if [ "$$test" = ".c" ]; then \
                echo "usage: ${MAKE} add-test NAME=<name>"; \
                exit; \
-       }; \
+       fi; \
        \
        if [ -f "$$test" ]; then \
                echo "error: test $$test already exists." 1>&2; \
@@ -205,25 +205,18 @@
                ' * TODO: Explain the purpose of the test.' \
                ' */' \
                '' \
-               '// TODO: Add some code that passes.' \
-       > "$$test"; \
-       printf '%s\n' \
-               '/* $$''NetBSD$$ */' \
-               '/* $$''FreeBSD$$ */' \
+               '#indent input' \
+               '// TODO: add input' \
+               '#indent end' \
                '' \
-               '/*' \
-               ' * TODO: Explain the command line options of the test.' \
-               ' */' \
-               '' \
-               '/* TODO: Add some command line options */' \
-       > "$$test.pro"; \
-       cat < "$$test" > "$$test.stdout"; \
-       cvs add "$$test" "$$test.pro" "$$test.stdout"; \
+               '#indent run [-options]' \
+               '// TODO: add expected output' \
+               '#indent end' \
+       > "$$test"; \
+       cvs add "$$test"; \
        printf '%s\n' \
                '/^FILES+=/i' \
                "FILES+=                $$test" \
-               "FILES+=                $$test.pro" \
-               "FILES+=                $$test.stdout" \
                '.' 'w' 'q' \
        | ed Makefile; \
        ${MAKE} sync-mi



Home | Main Index | Thread Index | Old Index