Module Name: src Committed By: rillig Date: Fri Jun 11 13:01:28 UTC 2021
Modified Files: src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk Log Message: tests/make: demonstrate handling of '+' and '*' in modifier ':?' It doesn't make sense that these two characters are handled differently, but that's what the current code has been doing for years. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.16 -r1.17 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.10 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.11 --- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.10 Mon Apr 19 23:51:42 2021 +++ src/usr.bin/make/unit-tests/varmod-ifelse.exp Fri Jun 11 13:01:28 2021 @@ -23,6 +23,10 @@ make: Bad conditional expression 'string 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: "varmod-ifelse.mk" line 167: true +make: "varmod-ifelse.mk" line 169: false +make: Bad conditional expression ' ' in ' ?true:false' +make: "varmod-ifelse.mk" line 171: 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.16 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.17 --- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.16 Mon Apr 19 23:51:42 2021 +++ src/usr.bin/make/unit-tests/varmod-ifelse.mk Fri Jun 11 13:01:28 2021 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.16 2021/04/19 23:51:42 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.17 2021/06/11 13:01:28 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -158,3 +158,14 @@ NUMBER= no # not really a number NUMBER= # empty, not really a number either .info ${${STRING} == "literal" && ${NUMBER} >= 10:?yes:no}. .info ${${STRING} == "literal" || ${NUMBER} >= 10:?yes:no}. + +# CondParser_LeafToken handles [0-9-+] specially, treating them as a number. +PLUS= + +ASTERISK= * +EMPTY= # empty +# "true" since "+" is not the empty string. +.info ${${PLUS} :?true:false} +# "false" since the variable named "*" is not defined. +.info ${${ASTERISK} :?true:false} +# syntax error since the condition is completely blank. +.info ${${EMPTY} :?true:false}