Module Name:    src
Committed By:   rillig
Date:           Sat Dec 19 20:35:39 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: directive-undef.mk

Log Message:
make(1): add tests for undefining variables with exotic names


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive-undef.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/directive-undef.mk
diff -u src/usr.bin/make/unit-tests/directive-undef.mk:1.6 src/usr.bin/make/unit-tests/directive-undef.mk:1.7
--- src/usr.bin/make/unit-tests/directive-undef.mk:1.6	Sun Dec 13 01:07:54 2020
+++ src/usr.bin/make/unit-tests/directive-undef.mk	Sat Dec 19 20:35:39 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-undef.mk,v 1.6 2020/12/13 01:07:54 rillig Exp $
+# $NetBSD: directive-undef.mk,v 1.7 2020/12/19 20:35:39 rillig Exp $
 #
 # Tests for the .undef directive.
 #
@@ -16,7 +16,34 @@
 .  warning $1$2$3
 .endif
 
+# Without any arguments, .undef tries to delete the variable with the empty
+# name, which never exists; see varname-empty.mk.
 .undef				# oops: missing argument
 
+
+# It must be possible to undefine variables whose name includes spaces.
+SPACE=		${:U }
+${SPACE}=	space
+.if !defined(${SPACE})
+.  error
+.endif
+.undef ${SPACE}
+.if defined(${SPACE})
+.  error
+.endif
+
+
+# It must be possible to undefine variables whose name includes dollars.
+DOLLAR=		$$
+${DOLLAR}=	dollar
+.if !defined(${DOLLAR})
+.  error
+.endif
+.undef ${DOLLAR}
+.if defined(${DOLLAR})
+.  error
+.endif
+
+
 all:
 	@:;

Reply via email to