Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make/unit-tests make(1): refine test for detecting m...



details:   https://anonhg.NetBSD.org/src/rev/dc0d302e309e
branches:  trunk
changeset: 936521:dc0d302e309e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jul 28 17:47:57 2020 +0000

description:
make(1): refine test for detecting misspellings in directives

The names of directives are only checked if the lines are actually
relevant.  In all other cases, the amount of work is reduced to the bare
minimum, which is just to scan for line continuations.

diffstat:

 usr.bin/make/unit-tests/directives.exp |   9 ++++++++-
 usr.bin/make/unit-tests/directives.mk  |  26 +++++++++++++++++++++++---
 2 files changed, 31 insertions(+), 4 deletions(-)

diffs (65 lines):

diff -r 50e6cd15c8e2 -r dc0d302e309e usr.bin/make/unit-tests/directives.exp
--- a/usr.bin/make/unit-tests/directives.exp    Tue Jul 28 17:18:40 2020 +0000
+++ b/usr.bin/make/unit-tests/directives.exp    Tue Jul 28 17:47:57 2020 +0000
@@ -24,7 +24,14 @@
 make: "directives.mk" line 90: begin .elif misspellings tests, part 1
 make: "directives.mk" line 100: begin .elif misspellings tests, part 2
 make: "directives.mk" line 110: begin .elif misspellings tests, part 3
-make: "directives.mk" line 120: end of the tests
+make: "directives.mk" line 120: which branch is taken on misspelling after false?
+make: "directives.mk" line 127: else taken
+make: "directives.mk" line 130: which branch is taken on misspelling after true?
+make: "directives.mk" line 132: Unknown directive
+make: "directives.mk" line 133: 1 taken
+make: "directives.mk" line 134: Unknown directive
+make: "directives.mk" line 135: 2 taken
+make: "directives.mk" line 140: end of the tests
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r 50e6cd15c8e2 -r dc0d302e309e usr.bin/make/unit-tests/directives.mk
--- a/usr.bin/make/unit-tests/directives.mk     Tue Jul 28 17:18:40 2020 +0000
+++ b/usr.bin/make/unit-tests/directives.mk     Tue Jul 28 17:47:57 2020 +0000
@@ -1,12 +1,12 @@
-# $NetBSD: directives.mk,v 1.1 2020/07/27 20:46:17 rillig Exp $
+# $NetBSD: directives.mk,v 1.2 2020/07/28 17:47:57 rillig Exp $
 #
 # Tests for parsing directives, in the same order as in the manual page.
 #
-# Each test group has 10 lines, to keep the expected file stable.
+# Each test group has 10 lines, to keep the line numbers in directives.exp
+# stable.
 #
 # no tests for .error since it exits immediately, see ParseMessage.
 
-
 .info begin .export tests
 .expor                         # misspelled
 .export                                # oops: missing argument
@@ -117,6 +117,26 @@
 
 
 
+.info which branch is taken on misspelling after false?
+.if 0
+.elsif 1
+.info 1 taken
+.elsif 2
+.info 2 taken
+.else
+.info else taken
+.endif
+
+.info which branch is taken on misspelling after true?
+.if 1
+.elsif 1
+.info 1 taken
+.elsif 2
+.info 2 taken
+.else
+.info else taken
+.endif
+
 .info end of the tests
 
 all:



Home | Main Index | Thread Index | Old Index