summaryrefslogtreecommitdiff
path: root/unit-tests/var-class-local.mk
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2020-11-07 19:39:21 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2020-11-07 19:39:21 +0000
commit302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (patch)
treec2146dca82d530521c4d2cc46a95c26964311a2c /unit-tests/var-class-local.mk
parent6bbc783f48498b808e19db4441299dc7d85a278b (diff)
Notes
Diffstat (limited to 'unit-tests/var-class-local.mk')
-rw-r--r--unit-tests/var-class-local.mk27
1 files changed, 25 insertions, 2 deletions
diff --git a/unit-tests/var-class-local.mk b/unit-tests/var-class-local.mk
index e75f08ba75a32..68696ea854af8 100644
--- a/unit-tests/var-class-local.mk
+++ b/unit-tests/var-class-local.mk
@@ -1,8 +1,31 @@
-# $NetBSD: var-class-local.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: var-class-local.mk,v 1.4 2020/10/25 09:46:25 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:
- @:;
+ # The ::= modifier overwrites the .TARGET variable in the node
+ # 'all', not in the global scope. This can be seen with the -dv
+ # option, looking for "all:@ = overwritten".
+ : ${.TARGET} ${.TARGET::=overwritten}${.TARGET}