Module Name: src
Committed By: rillig
Date: Mon Apr 19 23:43:15 UTC 2021
Modified Files:
src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk
Log Message:
tests/make: add another example for parsing of the modifier ':?'
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/varmod-ifelse.exp
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varmod-ifelse.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/varmod-ifelse.exp
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.8 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.9
--- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.8 Mon Apr 19 23:27:17 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.exp Mon Apr 19 23:43:14 2021
@@ -19,6 +19,10 @@ make: Bad conditional expression 'string
make: "varmod-ifelse.mk" line 153: .
make: Bad conditional expression 'string == "literal" || no >= 10' in 'string == "literal" || no >= 10?yes:no'
make: "varmod-ifelse.mk" line 154: .
+make: Bad conditional expression 'string == "literal" && >= 10' in 'string == "literal" && >= 10?yes:no'
+make: "varmod-ifelse.mk" line 159: .
+make: Bad conditional expression 'string == "literal" || >= 10' in 'string == "literal" || >= 10?yes:no'
+make: "varmod-ifelse.mk" line 160: .
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.14 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.15
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.14 Mon Apr 19 23:27:17 2021
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk Mon Apr 19 23:43:14 2021
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.14 2021/04/19 23:27:17 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.15 2021/04/19 23:43:14 rillig Exp $
#
# Tests for the ${cond:?then:else} variable modifier, which evaluates either
# the then-expression or the else-expression, depending on the condition.
@@ -152,3 +152,9 @@ STRING= string
NUMBER= no # not really a number
.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
.info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.
+
+# The following situation occasionally occurs with MKINET6 or similar
+# variables.
+NUMBER= # empty, not really a number either
+.info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}.
+.info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}.