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 nested assignm...



details:   https://anonhg.NetBSD.org/src/rev/51c812dbbb35
branches:  trunk
changeset: 936186:51c812dbbb35
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 20 19:03:25 2020 +0000

description:
make(1): add test for nested assignments

This test demonstrates that in ApplyModifier_Assign, the call to
ParseModifierPart must get its pflags.

diffstat:

 usr.bin/make/unit-tests/modmisc.exp |   4 ++++
 usr.bin/make/unit-tests/modmisc.mk  |  11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diffs (45 lines):

diff -r 387591350a36 -r 51c812dbbb35 usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Mon Jul 20 18:12:48 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Mon Jul 20 19:03:25 2020 +0000
@@ -78,5 +78,9 @@
 3
 mod-assign: ran:3.
 mod-assign: global: 1, 3, 1 2 3, 3.
+mod-assign-nested: then1t1
+mod-assign-nested: else2e2
+mod-assign-nested: then3t3
+mod-assign-nested: else4e4
 mod-tu-space: A   B
 exit status 0
diff -r 387591350a36 -r 51c812dbbb35 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Mon Jul 20 18:12:48 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Mon Jul 20 19:03:25 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.17 2020/07/20 16:12:02 rillig Exp $
+# $Id: modmisc.mk,v 1.18 2020/07/20 19:03:25 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -20,6 +20,7 @@
 all:   mod-subst-dollar mod-loop-dollar
 all:   mod-C-limits
 all:   mod-assign
+all:   mod-assign-nested
 all:   mod-tu-space
 
 modsysv:
@@ -158,6 +159,14 @@
        # preserved even after the shell command has been run.
        @echo $@: global: ${FIRST:Q}, ${LAST:Q}, ${APPENDED:Q}, ${RAN:Q}.
 
+mod-assign-nested:
+       @echo $@: ${1:?${THEN1::=then1${IT1::=t1}}:${ELSE1::=else1${IE1::=e1}}}${THEN1}${ELSE1}${IT1}${IE1}
+       @echo $@: ${0:?${THEN2::=then2${IT2::=t2}}:${ELSE2::=else2${IE2::=e2}}}${THEN2}${ELSE2}${IT2}${IE2}
+       @echo $@: ${SINK3:Q}
+       @echo $@: ${SINK4:Q}
+SINK3:=        ${1:?${THEN3::=then3${IT3::=t3}}:${ELSE3::=else3${IE3::=e3}}}${THEN3}${ELSE3}${IT3}${IE3}
+SINK4:=        ${0:?${THEN4::=then4${IT4::=t4}}:${ELSE4::=else4${IE4::=e4}}}${THEN4}${ELSE4}${IT4}${IE4}
+
 mod-tu-space:
        # The :tu and :tl modifiers operate on the variable value
        # as a single string, not as a list of words. Therefore,



Home | Main Index | Thread Index | Old Index