summaryrefslogtreecommitdiff
path: root/tests/scripts/variables/undefine
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@kolpackov.net>2009-10-06 06:56:57 +0000
committerBoris Kolpackov <boris@kolpackov.net>2009-10-06 06:56:57 +0000
commit4254e88cfa7704ea4a55d94a9aee5b19b081b3db (patch)
tree3810a48808d8d16647c39ccc47fd6af7a810b5c5 /tests/scripts/variables/undefine
parent174e910a1d73f6b12338b6bd0a0727085b041f22 (diff)
downloadgunmake-4254e88cfa7704ea4a55d94a9aee5b19b081b3db.tar.gz
Implement the new undefine directive.
Diffstat (limited to 'tests/scripts/variables/undefine')
-rw-r--r--tests/scripts/variables/undefine73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/scripts/variables/undefine b/tests/scripts/variables/undefine
new file mode 100644
index 0000000..38707b8
--- /dev/null
+++ b/tests/scripts/variables/undefine
@@ -0,0 +1,73 @@
+# -*-perl-*-
+
+$description = "Test variable undefine.";
+
+$details = "";
+
+# TEST 0: basic undefine functionality
+
+run_make_test('
+a = a
+b := b
+define c
+c
+endef
+
+$(info $(flavor a) $(flavor b) $(flavor c))
+
+n := b
+
+undefine a
+undefine $n
+undefine c
+
+$(info $(flavor a) $(flavor b) $(flavor c))
+
+
+all: ;@:
+',
+'', "recursive simple recursive\nundefined undefined undefined");
+
+
+# TEST 1: override
+
+run_make_test('
+undefine a
+override undefine b
+
+$(info $(flavor a) $(flavor b))
+
+
+all: ;@:
+',
+'a=a b=b', "recursive undefined");
+
+1;
+
+# TEST 2: undefine in eval (make sure we undefine from the global var set)
+
+run_make_test('
+define undef
+$(eval undefine $$1)
+endef
+
+a := a
+$(call undef,a)
+$(info $(flavor a))
+
+
+all: ;@:
+',
+'', "undefined");
+
+
+# TEST 3: Missing variable name
+
+run_make_test('
+a =
+undefine $a
+all: ;@echo ouch
+',
+'', "#MAKEFILE#:3: *** empty variable name. Stop.\n", 512);
+
+1;