Module Name: src Committed By: rillig Date: Fri Dec 10 20:22:54 UTC 2021
Modified Files: src/usr.bin/make/unit-tests: cond-op.exp cond-op.mk Log Message: tests/make: extend test for parse errors in conditions To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/cond-op.exp cvs rdiff -u -r1.13 -r1.14 src/usr.bin/make/unit-tests/cond-op.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/cond-op.exp diff -u src/usr.bin/make/unit-tests/cond-op.exp:1.9 src/usr.bin/make/unit-tests/cond-op.exp:1.10 --- src/usr.bin/make/unit-tests/cond-op.exp:1.9 Tue Jan 19 18:13:37 2021 +++ src/usr.bin/make/unit-tests/cond-op.exp Fri Dec 10 20:22:54 2021 @@ -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 Index: src/usr.bin/make/unit-tests/cond-op.mk diff -u src/usr.bin/make/unit-tests/cond-op.mk:1.13 src/usr.bin/make/unit-tests/cond-op.mk:1.14 --- src/usr.bin/make/unit-tests/cond-op.mk:1.13 Tue Jan 19 18:20:30 2021 +++ src/usr.bin/make/unit-tests/cond-op.mk Fri Dec 10 20:22:54 2021 @@ -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.