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/cab4d5812662
branches:  trunk
changeset: 936294:cab4d5812662
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 6bda388863c4 -r cab4d5812662 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 6bda388863c4 -r cab4d5812662 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