summaryrefslogtreecommitdiff
path: root/tests/scripts/variables/flavors
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/variables/flavors')
-rw-r--r--tests/scripts/variables/flavors76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/scripts/variables/flavors b/tests/scripts/variables/flavors
new file mode 100644
index 0000000..92feed6
--- /dev/null
+++ b/tests/scripts/variables/flavors
@@ -0,0 +1,76 @@
+# -*-perl-*-
+
+$description = "Test various flavors of make variable setting.";
+
+$details = "";
+
+# TEST 0: Recursive
+
+run_make_test('
+ugh = Goodbye
+foo = $(bar)
+bar = ${ugh}
+ugh = Hello
+all: ; @echo $(foo)
+',
+ '', "Hello\n");
+
+# TEST 1: Simple
+
+run_make_test('
+bar = Goodbye
+foo := $(bar)
+bar = ${ugh}
+ugh = Hello
+all: ; @echo $(foo)
+',
+ '', "Goodbye\n");
+
+# TEST 2: Append to recursive
+
+run_make_test('
+foo = Hello
+ugh = Goodbye
+foo += $(bar)
+bar = ${ugh}
+ugh = Hello
+all: ; @echo $(foo)
+',
+ '', "Hello Hello\n");
+
+# TEST 3: Append to simple
+
+run_make_test('
+foo := Hello
+ugh = Goodbye
+bar = ${ugh}
+foo += $(bar)
+ugh = Hello
+all: ; @echo $(foo)
+',
+ '', "Hello Goodbye\n");
+
+# TEST 4: Conditional pre-set
+
+run_make_test('
+foo = Hello
+ugh = Goodbye
+bar = ${ugh}
+foo ?= $(bar)
+ugh = Hello
+all: ; @echo $(foo)
+',
+ '', "Hello\n");
+
+# TEST 5: Conditional unset
+
+run_make_test('
+ugh = Goodbye
+bar = ${ugh}
+foo ?= $(bar)
+ugh = Hello
+all: ; @echo $(foo)
+',
+ '', "Hello\n");
+
+1;