Module Name: src
Committed By: rillig
Date: Sun Nov 8 22:56:16 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: cond-cmp-numeric.exp cond-cmp-numeric.mk
Log Message:
make(1): add test for wrong comparison operator in conditional
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/cond-cmp-numeric.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-cmp-numeric.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.2 src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.3
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.exp:1.2 Sat Sep 12 18:01:51 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.exp Sun Nov 8 22:56:16 2020
@@ -6,6 +6,10 @@ make: "cond-cmp-numeric.mk" line 16: war
make: "cond-cmp-numeric.mk" line 16: Malformed conditional (${:UNaN} > NaN)
CondParser_Eval: !(${:UNaN} == NaN)
lhs = "NaN", rhs = "NaN", op = ==
+CondParser_Eval: 123 ! 123
+lhs = 123.000000, rhs = 123.000000, op = !
+make: "cond-cmp-numeric.mk" line 34: warning: Unknown operator
+make: "cond-cmp-numeric.mk" line 34: Malformed conditional (123 ! 123)
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
Index: src/usr.bin/make/unit-tests/cond-cmp-numeric.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.3 src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.4
--- src/usr.bin/make/unit-tests/cond-cmp-numeric.mk:1.3 Sat Sep 12 18:01:51 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-numeric.mk Sun Nov 8 22:56:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-numeric.mk,v 1.3 2020/09/12 18:01:51 rillig Exp $
+# $NetBSD: cond-cmp-numeric.mk,v 1.4 2020/11/08 22:56:16 rillig Exp $
#
# Tests for numeric comparisons in .if conditions.
@@ -25,5 +25,17 @@
. error
.endif
+# The parsing code in CondParser_Comparison only performs a light check on
+# whether the operator is valid, leaving the rest of the work to the
+# evaluation functions EvalCompareNum and EvalCompareStr. Ensure that this
+# parse error is properly reported.
+#
+# XXX: The warning message does not mention the actual operator.
+.if 123 ! 123
+. error
+.else
+. error
+.endif
+
all:
@:;