Module Name: src Committed By: rillig Date: Sun Dec 20 19:29:06 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: modmisc.exp modmisc.mk varmod-indirect.exp varmod-indirect.mk Log Message: make(1): move tests for indirect modifiers around The next commit will error out on unknown modifiers and influence the exit status. The test modmisc.mk contains both parse time tests and run time tests. To prevent the latter from being run, the parse error is moved to varmod-indirect.mk, which only contains parse time tests. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.bin/make/unit-tests/modmisc.exp cvs rdiff -u -r1.51 -r1.52 src/usr.bin/make/unit-tests/modmisc.mk cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-indirect.exp \ src/usr.bin/make/unit-tests/varmod-indirect.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/modmisc.exp diff -u src/usr.bin/make/unit-tests/modmisc.exp:1.46 src/usr.bin/make/unit-tests/modmisc.exp:1.47 --- src/usr.bin/make/unit-tests/modmisc.exp:1.46 Sun Aug 23 15:18:43 2020 +++ src/usr.bin/make/unit-tests/modmisc.exp Sun Dec 20 19:29:06 2020 @@ -1,4 +1,3 @@ -make: Unknown modifier '$' path=':/bin:/tmp::/:.:/no/such/dir:.' path='/bin:/tmp:/:/no/such/dir' path='/bin:/tmp:/:/no/such/dir' Index: src/usr.bin/make/unit-tests/modmisc.mk diff -u src/usr.bin/make/unit-tests/modmisc.mk:1.51 src/usr.bin/make/unit-tests/modmisc.mk:1.52 --- src/usr.bin/make/unit-tests/modmisc.mk:1.51 Sun Nov 15 20:20:58 2020 +++ src/usr.bin/make/unit-tests/modmisc.mk Sun Dec 20 19:29:06 2020 @@ -1,4 +1,4 @@ -# $NetBSD: modmisc.mk,v 1.51 2020/11/15 20:20:58 rillig Exp $ +# $NetBSD: modmisc.mk,v 1.52 2020/12/20 19:29:06 rillig Exp $ # # miscellaneous modifier tests @@ -63,30 +63,3 @@ mod-quote: # Cover the bmake_realloc in Str_Words. mod-break-many-words: @echo $@: ${UNDEF:U:range=500:[#]} - -# To apply a modifier indirectly via another variable, the whole -# modifier must be put into a single variable expression. -.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}" -. warning unexpected -.endif - -# Adding another level of indirection (the 2 nested :U expressions) helps. -.if ${value:L:${:U${:US}${:U,value,replacement,}}} != "replacement" -. warning unexpected -.endif - -# Multiple indirect modifiers can be applied one after another as long as -# they are separated with colons. -.if ${value:L:${:US,a,A,}:${:US,e,E,}} != "vAluE" -. warning unexpected -.endif - -# An indirect variable that evaluates to the empty string is allowed though. -# This makes it possible to define conditional modifiers, like this: -# -# M.little-endian= S,1234,4321, -# M.big-endian= # none -.if ${value:L:${:Dempty}S,a,A,} != "vAlue" -. warning unexpected -.endif - Index: src/usr.bin/make/unit-tests/varmod-indirect.exp diff -u src/usr.bin/make/unit-tests/varmod-indirect.exp:1.1 src/usr.bin/make/unit-tests/varmod-indirect.exp:1.2 --- src/usr.bin/make/unit-tests/varmod-indirect.exp:1.1 Tue Dec 1 22:16:36 2020 +++ src/usr.bin/make/unit-tests/varmod-indirect.exp Sun Dec 20 19:29:06 2020 @@ -1 +1,2 @@ +make: Unknown modifier '$' exit status 0 Index: src/usr.bin/make/unit-tests/varmod-indirect.mk diff -u src/usr.bin/make/unit-tests/varmod-indirect.mk:1.1 src/usr.bin/make/unit-tests/varmod-indirect.mk:1.2 --- src/usr.bin/make/unit-tests/varmod-indirect.mk:1.1 Tue Dec 1 22:16:36 2020 +++ src/usr.bin/make/unit-tests/varmod-indirect.mk Sun Dec 20 19:29:06 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-indirect.mk,v 1.1 2020/12/01 22:16:36 rillig Exp $ +# $NetBSD: varmod-indirect.mk,v 1.2 2020/12/20 19:29:06 rillig Exp $ # # Tests for indirect variable modifiers, such as in ${VAR:${M_modifiers}}. # These can be used for very basic purposes like converting a string to either @@ -8,6 +8,36 @@ # TODO: Since when are indirect modifiers supported? +# To apply a modifier indirectly via another variable, the whole +# modifier must be put into a single variable expression. +.if ${value:L:${:US}${:U,value,replacement,}} != "S,value,replacement,}" +. warning unexpected +.endif + + +# Adding another level of indirection (the 2 nested :U expressions) helps. +.if ${value:L:${:U${:US}${:U,value,replacement,}}} != "replacement" +. warning unexpected +.endif + + +# Multiple indirect modifiers can be applied one after another as long as +# they are separated with colons. +.if ${value:L:${:US,a,A,}:${:US,e,E,}} != "vAluE" +. warning unexpected +.endif + + +# An indirect variable that evaluates to the empty string is allowed though. +# This makes it possible to define conditional modifiers, like this: +# +# M.little-endian= S,1234,4321, +# M.big-endian= # none +.if ${value:L:${:Dempty}S,a,A,} != "vAlue" +. warning unexpected +.endif + + # The nested variable expression expands to "tu", and this is interpreted as # a variable modifier for the value "Upper", resulting in "UPPER". .if ${Upper:L:${:Utu}} != "UPPER"