Module Name:    src
Committed By:   rillig
Date:           Mon Nov  2 22:29:48 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: varname.exp varname.mk

Log Message:
make(1): fix test for parsing obscure variable names

I had forgotten the :U modifier.  Without that modifier, there's no
chance that the variable names would come out correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varname.exp
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varname.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/varname.exp
diff -u src/usr.bin/make/unit-tests/varname.exp:1.4 src/usr.bin/make/unit-tests/varname.exp:1.5
--- src/usr.bin/make/unit-tests/varname.exp:1.4	Mon Nov  2 22:16:24 2020
+++ src/usr.bin/make/unit-tests/varname.exp	Mon Nov  2 22:29:48 2020
@@ -4,16 +4,21 @@ Global:VARNAME = VAR(((
 Var_Parse: ${VARNAME} with VARE_WANTRES
 Global:VAR((( = 3 open parentheses
 Var_Parse: ${VAR(((}}}}" != "3 open parentheses}}}" with VARE_WANTRES
-Var_Parse: ${VAR(((}=	try1 with VARE_UNDEFERR|VARE_WANTRES
-Global:.ALLTARGETS =  3
-Global:.ALLTARGETS =  3 open
-Global:.ALLTARGETS =  3 open parentheses=
+Var_Parse: ${:UVAR(((}=	try1 with VARE_UNDEFERR|VARE_WANTRES
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Result of ${:UVAR(((} is "VAR(((" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Global:.ALLTARGETS =  VAR(((=)
+No closing parenthesis in archive specification
+make: "varname.mk" line 26: Error in archive specification: "VAR"
+Var_Parse: ${:UVAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
+Global:.ALLTARGETS =  VAR(((=) VAR\(\(\(=
 make: "varname.mk" line 27: Need an operator
-Var_Parse: ${VAR\(\(\(}=	try2 with VARE_UNDEFERR|VARE_WANTRES
-Global:.ALLTARGETS =  3 open parentheses= =
+Var_Parse: ${:UVAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
+Applying ${:U...} to "" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF)
+Result of ${:UVAR\(\(\(} is "VAR\(\(\(" (VARE_UNDEFERR|VARE_WANTRES, none, VEF_UNDEF|VEF_DEF)
 make: "varname.mk" line 28: Need an operator
-Var_Parse: ${VAR\(\(\(}=	try3 with VARE_UNDEFERR|VARE_WANTRES
-make: "varname.mk" line 29: Need an operator
 Global:.MAKEFLAGS =  -r -k -d v -d
 Global:.MAKEFLAGS =  -r -k -d v -d 0
 make: Fatal errors encountered -- cannot continue

Index: src/usr.bin/make/unit-tests/varname.mk
diff -u src/usr.bin/make/unit-tests/varname.mk:1.5 src/usr.bin/make/unit-tests/varname.mk:1.6
--- src/usr.bin/make/unit-tests/varname.mk:1.5	Mon Nov  2 22:16:24 2020
+++ src/usr.bin/make/unit-tests/varname.mk	Mon Nov  2 22:29:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varname.mk,v 1.5 2020/11/02 22:16:24 rillig Exp $
+# $NetBSD: varname.mk,v 1.6 2020/11/02 22:29:48 rillig Exp $
 #
 # Tests for special variables, such as .MAKE or .PARSEDIR.
 # And for variable names in general.
@@ -23,10 +23,9 @@ ${VARNAME}=	3 open parentheses
 
 # In the above test, the variable name is constructed indirectly.  Neither
 # of the following expressions produces the intended effect.
-# TODO: explain what happens in the parser here.
-${VAR(((}=	try1
-${VAR\(\(\(}=	try2
-${VAR\(\(\(}=	try3
+${:UVAR(((}=	try1
+${:UVAR\(\(\(}=	try2
+${:UVAR\(\(\(}=	try3
 
 .MAKEFLAGS: -d0
 

Reply via email to