diff options
Diffstat (limited to 'unit-tests/directive-for.mk')
| -rwxr-xr-x | unit-tests/directive-for.mk | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/unit-tests/directive-for.mk b/unit-tests/directive-for.mk index 572c4d6a5c92..95171c68031f 100755 --- a/unit-tests/directive-for.mk +++ b/unit-tests/directive-for.mk @@ -1,4 +1,4 @@ -# $NetBSD: directive-for.mk,v 1.13 2022/01/15 12:35:18 rillig Exp $ +# $NetBSD: directive-for.mk,v 1.15 2022/10/01 09:23:04 rillig Exp $ # # Tests for the .for directive. # @@ -228,3 +228,19 @@ var= outer endfor .endfor .MAKEFLAGS: -d0 + + +# When there is a variable definition 'scope=cmdline' from the command line +# (which has higher precedence than global variables) and a .for loop iterates +# over a variable of the same name, the expression '${scope}' expands to the +# value from the .for loop. This is because when the body of the .for loop is +# expanded, the expression '${scope}' is textually replaced with ${:Uloop}', +# without resolving any other variable names (ForLoop_SubstBody). Later, when +# the body of the .for loop is actually interpreted, the body text doesn't +# contain the word 'scope' anymore. +.MAKEFLAGS: scope=cmdline +.for scope in loop +. if ${scope} != "loop" +. error +. endif +.endfor |
