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 tests/make: extend test for parse er...



details:   https://anonhg.NetBSD.org/src/rev/67b46e5dbe2f
branches:  trunk
changeset: 1027547:67b46e5dbe2f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Dec 10 20:22:54 2021 +0000

description:
tests/make: extend test for parse errors in conditions

diffstat:

 usr.bin/make/unit-tests/cond-op.exp |  34 ++++++++++++++++++----------------
 usr.bin/make/unit-tests/cond-op.mk  |  13 +++++++++++--
 2 files changed, 29 insertions(+), 18 deletions(-)

diffs (73 lines):

diff -r 69f0db5f08e4 -r 67b46e5dbe2f usr.bin/make/unit-tests/cond-op.exp
--- a/usr.bin/make/unit-tests/cond-op.exp       Fri Dec 10 20:06:29 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-op.exp       Fri Dec 10 20:22:54 2021 +0000
@@ -1,20 +1,22 @@
 make: "cond-op.mk" line 50: Malformed conditional ("!word" == !word)
-make: "cond-op.mk" line 75: Malformed conditional (0 ${ERR::=evaluated})
-make: "cond-op.mk" line 79: After detecting a parse error, the rest is evaluated.
-make: "cond-op.mk" line 83: Parsing continues until here.
-make: "cond-op.mk" line 86: A B C   =>   (A || B) && C   A || B && C   A || (B && C)
-make: "cond-op.mk" line 93: 0 0 0   =>   0               0             0
-make: "cond-op.mk" line 93: 0 0 1   =>   0               0             0
-make: "cond-op.mk" line 93: 0 1 0   =>   0               0             0
-make: "cond-op.mk" line 93: 0 1 1   =>   1               1             1
-make: "cond-op.mk" line 93: 1 0 0   =>   0               1             1
-make: "cond-op.mk" line 93: 1 0 1   =>   1               1             1
-make: "cond-op.mk" line 93: 1 1 0   =>   0               1             1
-make: "cond-op.mk" line 93: 1 1 1   =>   1               1             1
-make: "cond-op.mk" line 104: Malformed conditional (1 &&)
-make: "cond-op.mk" line 112: Malformed conditional (0 &&)
-make: "cond-op.mk" line 120: Malformed conditional (1 ||)
-make: "cond-op.mk" line 129: Malformed conditional (0 ||)
+make: "cond-op.mk" line 76: Malformed conditional (0 ${ERR::=evaluated})
+make: "cond-op.mk" line 80: After detecting a parse error after 0, the rest is evaluated.
+make: "cond-op.mk" line 84: Malformed conditional (1 ${ERR::=evaluated})
+make: "cond-op.mk" line 88: After detecting a parse error after 1, the rest is evaluated.
+make: "cond-op.mk" line 92: Parsing continues until here.
+make: "cond-op.mk" line 95: A B C   =>   (A || B) && C   A || B && C   A || (B && C)
+make: "cond-op.mk" line 102: 0 0 0   =>   0               0             0
+make: "cond-op.mk" line 102: 0 0 1   =>   0               0             0
+make: "cond-op.mk" line 102: 0 1 0   =>   0               0             0
+make: "cond-op.mk" line 102: 0 1 1   =>   1               1             1
+make: "cond-op.mk" line 102: 1 0 0   =>   0               1             1
+make: "cond-op.mk" line 102: 1 0 1   =>   1               1             1
+make: "cond-op.mk" line 102: 1 1 0   =>   0               1             1
+make: "cond-op.mk" line 102: 1 1 1   =>   1               1             1
+make: "cond-op.mk" line 113: Malformed conditional (1 &&)
+make: "cond-op.mk" line 121: Malformed conditional (0 &&)
+make: "cond-op.mk" line 129: Malformed conditional (1 ||)
+make: "cond-op.mk" line 138: Malformed conditional (0 ||)
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r 69f0db5f08e4 -r 67b46e5dbe2f usr.bin/make/unit-tests/cond-op.mk
--- a/usr.bin/make/unit-tests/cond-op.mk        Fri Dec 10 20:06:29 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-op.mk        Fri Dec 10 20:22:54 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op.mk,v 1.13 2021/01/19 18:20:30 rillig Exp $
+# $NetBSD: cond-op.mk,v 1.14 2021/12/10 20:22:54 rillig Exp $
 #
 # Tests for operators like &&, ||, ! in .if conditions.
 #
@@ -72,11 +72,20 @@
 # This would add a good deal of complexity to the code though, for almost
 # no benefit, especially since most expressions and conditions are side
 # effect free.
+.undef ERR
 .if 0 ${ERR::=evaluated}
 .  error
 .endif
 .if ${ERR:Uundefined} == evaluated
-.  info After detecting a parse error, the rest is evaluated.
+.  info After detecting a parse error after 0, the rest is evaluated.
+.endif
+
+.undef ERR
+.if 1 ${ERR::=evaluated}
+.  error
+.endif
+.if ${ERR:Uundefined} == evaluated
+.  info After detecting a parse error after 1, the rest is evaluated.
 .endif
 
 # Just in case that parsing should ever stop on the first error.



Home | Main Index | Thread Index | Old Index