Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add tests for undefining va...



details:   https://anonhg.NetBSD.org/src/rev/910c010ccd84
branches:  trunk
changeset: 947893:910c010ccd84
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Dec 19 20:35:39 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/directive-undef.mk |  29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r 4fdfd25a2f93 -r 910c010ccd84 usr.bin/make/unit-tests/directive-undef.mk
--- a/usr.bin/make/unit-tests/directive-undef.mk        Sat Dec 19 20:16:36 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-undef.mk        Sat Dec 19 20:35:39 2020 +0000
@@ -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:
        @:;



Home | Main Index | Thread Index | Old Index