summaryrefslogtreecommitdiff
path: root/tests/scripts/options/warn-undefined-variables
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/options/warn-undefined-variables')
-rw-r--r--tests/scripts/options/warn-undefined-variables25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/scripts/options/warn-undefined-variables b/tests/scripts/options/warn-undefined-variables
new file mode 100644
index 0000000..34bfaea
--- /dev/null
+++ b/tests/scripts/options/warn-undefined-variables
@@ -0,0 +1,25 @@
+# -*-perl-*-
+
+$description = "Test the --warn-undefined-variables option.";
+
+$details = "Verify that warnings are printed for referencing undefined variables.";
+
+# Without --warn-undefined-variables, nothing should happen
+run_make_test('
+EMPTY =
+EREF = $(EMPTY)
+UREF = $(UNDEFINED)
+
+SEREF := $(EREF)
+SUREF := $(UREF)
+
+all: ; @echo ref $(EREF) $(UREF)',
+ '', 'ref');
+
+# With --warn-undefined-variables, it should warn me
+run_make_test(undef, '--warn-undefined-variables',
+ "#MAKEFILE#:7: warning: undefined variable `UNDEFINED'
+#MAKEFILE#:9: warning: undefined variable `UNDEFINED'
+ref");
+
+1;