Module Name: src Committed By: rillig Date: Sun Sep 13 07:32:32 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: varmod-loop.exp varmod-loop.mk Log Message: make(1): add test for empty variable name in :@var@...@ modifier To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varmod-loop.exp \ src/usr.bin/make/unit-tests/varmod-loop.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/varmod-loop.exp diff -u src/usr.bin/make/unit-tests/varmod-loop.exp:1.2 src/usr.bin/make/unit-tests/varmod-loop.exp:1.3 --- src/usr.bin/make/unit-tests/varmod-loop.exp:1.2 Sun Aug 16 12:30:45 2020 +++ src/usr.bin/make/unit-tests/varmod-loop.exp Sun Sep 13 07:32:32 2020 @@ -3,6 +3,7 @@ :x1y x2y x3y: :mod-loop-varname: :x1y x2y x3y: :: :x1y x2y x3y: +empty: :xy xy xy: mod-loop-resolve:w1d2d3w w2i3w w1i2d3 2i${RES3}w w1d2d3 2i${RES3} 1i${RES2}w: mod-loop-varname-dollar:(1) (2) (3). mod-loop-varname-dollar:() () (). Index: src/usr.bin/make/unit-tests/varmod-loop.mk diff -u src/usr.bin/make/unit-tests/varmod-loop.mk:1.2 src/usr.bin/make/unit-tests/varmod-loop.mk:1.3 --- src/usr.bin/make/unit-tests/varmod-loop.mk:1.2 Sun Aug 16 12:30:45 2020 +++ src/usr.bin/make/unit-tests/varmod-loop.mk Sun Sep 13 07:32:32 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-loop.mk,v 1.2 2020/08/16 12:30:45 rillig Exp $ +# $NetBSD: varmod-loop.mk,v 1.3 2020/09/13 07:32:32 rillig Exp $ # # Tests for the :@var@...${var}...@ variable modifier. @@ -27,6 +27,11 @@ mod-loop-varname: # It needs to be doubled though. @echo :${:U1 2 3:@\\@x${${:Ux:S,x,\\,}}y@}: + # The variable name can technically be empty, and in this situation + # the variable value cannot be accessed since the empty variable is + # protected to always return an empty string. + @echo empty: :${:U1 2 3:@@x${}y@}: + # The :@ modifier resolves the variables a little more often than expected. # In particular, it resolves _all_ variables from the context, and not only # the loop variable (in this case v).