Module Name:    src
Committed By:   rillig
Date:           Thu Jul  2 16:37:56 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: cond-short.exp cond-short.mk

Log Message:
make(1): demonstrate some more cases for unintended evaluation


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-short.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-short.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/cond-short.exp
diff -u src/usr.bin/make/unit-tests/cond-short.exp:1.6 src/usr.bin/make/unit-tests/cond-short.exp:1.7
--- src/usr.bin/make/unit-tests/cond-short.exp:1.6	Thu Jul  2 13:04:09 2020
+++ src/usr.bin/make/unit-tests/cond-short.exp	Thu Jul  2 16:37:56 2020
@@ -4,6 +4,12 @@ expected and empty
 expected U23 condition
 expected VAR23
 expected M pattern
+unexpected S modifier
+unexpected C modifier
+unexpected = modifier
+unexpected @ modifier
+unexpected @ modifier
+unexpected @ modifier
 expected or
 expected or exists
 expected or empty

Index: src/usr.bin/make/unit-tests/cond-short.mk
diff -u src/usr.bin/make/unit-tests/cond-short.mk:1.5 src/usr.bin/make/unit-tests/cond-short.mk:1.6
--- src/usr.bin/make/unit-tests/cond-short.mk:1.5	Thu Jul  2 13:04:09 2020
+++ src/usr.bin/make/unit-tests/cond-short.mk	Thu Jul  2 16:37:56 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-short.mk,v 1.5 2020/07/02 13:04:09 rillig Exp $
+# $NetBSD: cond-short.mk,v 1.6 2020/07/02 16:37:56 rillig Exp $
 #
 # Demonstrates that in conditions, the right-hand side of an && or ||
 # is only evaluated if it can actually influence the result.
@@ -48,6 +48,24 @@ VAR=	# empty again, for the following te
 .if 1 && !empty(VAR:M${:U${echo   "expected M pattern" 1>&2 :L:sh}})
 .endif
 
+.if 0 && !empty(VAR:S,from,${:U${echo "unexpected S modifier" 1>&2 :L:sh}},)
+.endif
+
+.if 0 && !empty(VAR:C,from,${:U${echo "unexpected C modifier" 1>&2 :L:sh}},)
+.endif
+
+.if 0 && !empty("" == "" :? ${:U${echo "unexpected ? modifier" 1>&2 :L:sh}} :)
+.endif
+
+.if 0 && !empty(VAR:old=${:U${echo "unexpected = modifier" 1>&2 :L:sh}})
+.endif
+
+.if 0 && !empty(1 2 3:L:@var@${:U${echo "unexpected @ modifier" 1>&2 :L:sh}}@)
+.endif
+
+.if 0 && !empty(:U${:!echo "unexpected exclam modifier" 1>&2 !})
+.endif
+
 # The || operator.
 
 .if 1 || ${echo "unexpected or" 1>&2 :L:sh}

Reply via email to