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 tests for combining the...



details:   https://anonhg.NetBSD.org/src/rev/5fa2cf2b631a
branches:  trunk
changeset: 943843:5fa2cf2b631a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 12 07:04:51 2020 +0000

description:
make(1): add tests for combining the :D and :U variable modifiers

diffstat:

 usr.bin/make/unit-tests/varmod-defined.mk   |  17 ++++++++++++++++-
 usr.bin/make/unit-tests/varmod-undefined.mk |  14 ++++++++------
 2 files changed, 24 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r 838621e405b9 -r 5fa2cf2b631a usr.bin/make/unit-tests/varmod-defined.mk
--- a/usr.bin/make/unit-tests/varmod-defined.mk Sat Sep 12 06:09:16 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-defined.mk Sat Sep 12 07:04:51 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-defined.mk,v 1.4 2020/09/03 18:52:36 rillig Exp $
+# $NetBSD: varmod-defined.mk,v 1.5 2020/09/12 07:04:51 rillig Exp $
 #
 # Tests for the :D variable modifier, which returns the given string
 # if the variable is defined.  It is closely related to the :U modifier.
@@ -60,6 +60,21 @@
 .  error
 .endif
 
+# The :D modifier is often used in combination with the :U modifier.
+# It does not matter in which order the :D and :U modifiers appear.
+.if ${UNDEF:Dyes:Uno} != no
+.  error
+.endif
+.if ${UNDEF:Uno:Dyes} != no
+.  error
+.endif
+.if ${DEF:Dyes:Uno} != yes
+.  error
+.endif
+.if ${DEF:Uno:Dyes} != yes
+.  error
+.endif
+
 # TODO: Add more tests for parsing the plain text part, to cover each branch
 # of ApplyModifier_Defined.
 
diff -r 838621e405b9 -r 5fa2cf2b631a usr.bin/make/unit-tests/varmod-undefined.mk
--- a/usr.bin/make/unit-tests/varmod-undefined.mk       Sat Sep 12 06:09:16 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-undefined.mk       Sat Sep 12 07:04:51 2020 +0000
@@ -1,21 +1,23 @@
-# $NetBSD: varmod-undefined.mk,v 1.4 2020/09/03 18:52:36 rillig Exp $
+# $NetBSD: varmod-undefined.mk,v 1.5 2020/09/12 07:04:51 rillig Exp $
 #
 # Tests for the :U variable modifier, which returns the given string
 # if the variable is undefined.
 #
+# See also:
+#      varmod-defined.mk
+
 # The pattern ${:Uword} is heavily used when expanding .for loops.
-
+#
 # This is how an expanded .for loop looks like.
 # .for word in one
 # .  if ${word} != one
+.if ${:Uone} != one
 # .    error ${word}
+.  error ${:Uone}
 # .  endif
+.endif
 # .endfor
 
-.if ${:Uone} != one
-.  error ${:Uone}
-.endif
-
 # The variable expressions in the text of the :U modifier may be arbitrarily
 # nested.
 



Home | Main Index | Thread Index | Old Index