Module Name:    src
Committed By:   rillig
Date:           Fri Oct 23 17:21:22 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: var-class-local.mk

Log Message:
make(1): add test for variable name aliasing


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/var-class-local.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/var-class-local.mk
diff -u src/usr.bin/make/unit-tests/var-class-local.mk:1.2 src/usr.bin/make/unit-tests/var-class-local.mk:1.3
--- src/usr.bin/make/unit-tests/var-class-local.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/var-class-local.mk	Fri Oct 23 17:21:22 2020
@@ -1,8 +1,28 @@
-# $NetBSD: var-class-local.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: var-class-local.mk,v 1.3 2020/10/23 17:21:22 rillig Exp $
 #
 # Tests for target-local variables, such as ${.TARGET} or $@.
 
 # TODO: Implementation
 
+# Ensure that the name of the variable is exactly the given one.
+# The variable "@" is an alias for ".TARGET", so the implementation might
+# canonicalize these aliases at some point, and that might be surprising.
+# This aliasing happens for single-character variable names like $@ or $<
+# (see VarFind, CanonicalVarname), but not for braced or parenthesized
+# expressions like ${@}, ${.TARGET} ${VAR:Mpattern} (see Var_Parse,
+# ParseVarname).
+.if ${@:L} != "@"
+.  error
+.endif
+.if ${.TARGET:L} != ".TARGET"
+.  error
+.endif
+.if ${@F:L} != "@F"
+.  error
+.endif
+.if ${@D:L} != "@D"
+.  error
+.endif
+
 all:
 	@:;

Reply via email to