Module Name: src
Committed By: rillig
Date: Sun Jun 2 17:44:48 UTC 2024
Modified Files:
src/usr.bin/make/unit-tests: varmod-undefined.mk
Log Message:
tests/make: test more details of the :U and :D modifiers
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-undefined.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-undefined.mk
diff -u src/usr.bin/make/unit-tests/varmod-undefined.mk:1.9 src/usr.bin/make/unit-tests/varmod-undefined.mk:1.10
--- src/usr.bin/make/unit-tests/varmod-undefined.mk:1.9 Sun Nov 19 21:47:52 2023
+++ src/usr.bin/make/unit-tests/varmod-undefined.mk Sun Jun 2 17:44:48 2024
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-undefined.mk,v 1.9 2023/11/19 21:47:52 rillig Exp $
+# $NetBSD: varmod-undefined.mk,v 1.10 2024/06/02 17:44:48 rillig Exp $
#
# Tests for the :U variable modifier, which returns the given string
# if the variable is undefined.
@@ -53,6 +53,10 @@
.if ${:U \: \} \$ \\ \a \b \n } != " : } \$ \\ \\a \\b \\n "
. error
.endif
+# An expression enclosed in quotes may be based on an undefined variable.
+.if "${:U \: \} \$ \\ \a \b \n }" != " : } \$ \\ \\a \\b \\n "
+. error
+.endif
# Even after the :U modifier has been applied, the expression still remembers
# that it originated from an undefined variable, and the :U modifier can
@@ -64,5 +68,43 @@
. error
.endif
-all:
- @:;
+
+# VARE_PARSE
+.if 0 && ${:U . \: \} \$ \\ ${EXPR}}
+. error
+.endif
+
+# VARE_EVAL_KEEP_DOLLAR_AND_UNDEFINED
+SUBST:= ${:U . \: \} \$ \\ ${EXPR}}
+${:U }= <space>
+EXPR= <expr>
+.if ${SUBST} != " . : } <space>\\ "
+. error
+.endif
+
+8_DOLLAR= $$$$$$$$
+.if ${8_DOLLAR} != "\$\$\$\$"
+. error
+.endif
+.if ${:U${8_DOLLAR}} != "\$\$\$\$"
+. error
+.endif
+.if ${x:L:@_@${8_DOLLAR}@} != "\$\$\$\$"
+. error
+.endif
+EXPR:= ${8_DOLLAR}
+.if ${EXPR} != "\$\$\$\$"
+. error
+.endif
+EXPR:= ${:U${8_DOLLAR}}
+.if ${EXPR} != "\$\$\$\$"
+. error
+.endif
+# VARE_EVAL_KEEP_UNDEFINED
+EXPR:= ${x:L:@_@${8_DOLLAR}@}
+.if ${EXPR} != "\$\$"
+. error
+.endif
+
+
+all: .PHONY