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): add test for wrong comparis...
details: https://anonhg.NetBSD.org/src/rev/83187fcb9202
branches: trunk
changeset: 1016139:83187fcb9202
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Nov 08 22:56:16 2020 +0000
description:
make(1): add test for wrong comparison operator in conditional
diffstat:
usr.bin/make/unit-tests/cond-cmp-numeric.exp | 4 ++++
usr.bin/make/unit-tests/cond-cmp-numeric.mk | 14 +++++++++++++-
2 files changed, 17 insertions(+), 1 deletions(-)
diffs (41 lines):
diff -r 74be77a90b32 -r 83187fcb9202 usr.bin/make/unit-tests/cond-cmp-numeric.exp
--- a/usr.bin/make/unit-tests/cond-cmp-numeric.exp Sun Nov 08 22:45:51 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-numeric.exp Sun Nov 08 22:56:16 2020 +0000
@@ -6,6 +6,10 @@
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
diff -r 74be77a90b32 -r 83187fcb9202 usr.bin/make/unit-tests/cond-cmp-numeric.mk
--- a/usr.bin/make/unit-tests/cond-cmp-numeric.mk Sun Nov 08 22:45:51 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-cmp-numeric.mk Sun Nov 08 22:56:16 2020 +0000
@@ -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:
@:;
Home |
Main Index |
Thread Index |
Old Index