Module Name:    src
Committed By:   rillig
Date:           Tue Jul 28 17:47:57 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: directives.exp directives.mk

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directives.exp \
    src/usr.bin/make/unit-tests/directives.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/directives.exp
diff -u src/usr.bin/make/unit-tests/directives.exp:1.1 src/usr.bin/make/unit-tests/directives.exp:1.2
--- src/usr.bin/make/unit-tests/directives.exp:1.1	Mon Jul 27 20:46:17 2020
+++ src/usr.bin/make/unit-tests/directives.exp	Tue Jul 28 17:47:57 2020
@@ -24,7 +24,14 @@ make: "directives.mk" line 86: warning: 
 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
Index: src/usr.bin/make/unit-tests/directives.mk
diff -u src/usr.bin/make/unit-tests/directives.mk:1.1 src/usr.bin/make/unit-tests/directives.mk:1.2
--- src/usr.bin/make/unit-tests/directives.mk:1.1	Mon Jul 27 20:46:17 2020
+++ src/usr.bin/make/unit-tests/directives.mk	Tue Jul 28 17:47:57 2020
@@ -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:

Reply via email to