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): demonstrate some more cases...



details:   https://anonhg.NetBSD.org/src/rev/e56f1a40b139
branches:  trunk
changeset: 935431:e56f1a40b139
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 02 16:37:56 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/cond-short.exp |   6 ++++++
 usr.bin/make/unit-tests/cond-short.mk  |  20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)

diffs (50 lines):

diff -r 1ac416109495 -r e56f1a40b139 usr.bin/make/unit-tests/cond-short.exp
--- a/usr.bin/make/unit-tests/cond-short.exp    Thu Jul 02 16:14:50 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-short.exp    Thu Jul 02 16:37:56 2020 +0000
@@ -4,6 +4,12 @@
 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
diff -r 1ac416109495 -r e56f1a40b139 usr.bin/make/unit-tests/cond-short.mk
--- a/usr.bin/make/unit-tests/cond-short.mk     Thu Jul 02 16:14:50 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-short.mk     Thu Jul 02 16:37:56 2020 +0000
@@ -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 @@
 .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}



Home | Main Index | Thread Index | Old Index