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 undefined (or ...
details: https://anonhg.NetBSD.org/src/rev/c315e5c0156e
branches: trunk
changeset: 1012163:c315e5c0156e
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jul 25 20:37:46 2020 +0000
description:
make(1): add test for undefined (or empty) variable in :? modifier
diffstat:
usr.bin/make/unit-tests/cond-late.exp | 1 +
usr.bin/make/unit-tests/cond-late.mk | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r 773e125d385f -r c315e5c0156e usr.bin/make/unit-tests/cond-late.exp
--- a/usr.bin/make/unit-tests/cond-late.exp Sat Jul 25 20:35:35 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-late.exp Sat Jul 25 20:37:46 2020 +0000
@@ -1,3 +1,4 @@
+make: Bad conditional expression ` != "no"' in != "no"?:
yes
no
exit status 0
diff -r 773e125d385f -r c315e5c0156e usr.bin/make/unit-tests/cond-late.mk
--- a/usr.bin/make/unit-tests/cond-late.mk Sat Jul 25 20:35:35 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-late.mk Sat Jul 25 20:37:46 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-late.mk,v 1.1 2020/04/29 23:15:21 rillig Exp $
+# $NetBSD: cond-late.mk,v 1.2 2020/07/25 20:37:46 rillig Exp $
#
# Using the :? modifier, variable expressions can contain conditional
# expressions that are evaluated late. Any variables appearing in these
@@ -15,9 +15,15 @@
# and then expand the variables, the output would change from the
# current "yes no" to "yes yes", since both variables are non-empty.
+all: cond-literal
+
COND.true= "yes" == "yes"
COND.false= "yes" != "yes"
-all:
+cond-literal:
@echo ${ ${COND.true} :?yes:no}
@echo ${ ${COND.false} :?yes:no}
+
+VAR+= ${${UNDEF} != "no":?:}
+.if empty(VAR:Mpattern)
+.endif
Home |
Main Index |
Thread Index |
Old Index