summaryrefslogtreecommitdiff
path: root/tests/scripts/variables
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2004-09-21 05:39:04 +0000
committerPaul Smith <psmith@gnu.org>2004-09-21 05:39:04 +0000
commit9714e501fb356adb043c77a3180a7f8c16c1484d (patch)
tree39676649d3912502fc3f4231ffafafa18b289ad8 /tests/scripts/variables
parent0799ce730d2404d1cd1d03ce2f4ac07cc079c72e (diff)
downloadgunmake-9714e501fb356adb043c77a3180a7f8c16c1484d.tar.gz
Add some more unit tests for variable flavors.
Allow run_make_tests() to be invoked with an undef makefile string, in which case it re-uses the previous string.
Diffstat (limited to 'tests/scripts/variables')
-rw-r--r--tests/scripts/variables/flavors73
1 files changed, 73 insertions, 0 deletions
diff --git a/tests/scripts/variables/flavors b/tests/scripts/variables/flavors
index c9025b2..88e9ad5 100644
--- a/tests/scripts/variables/flavors
+++ b/tests/scripts/variables/flavors
@@ -81,5 +81,78 @@ $answer = "$makefile:24: *** empty variable name. Stop.\n";
$answer = "A = B\n";
&compare_output($answer, &get_logfile(1));
+# Clean up from "old style" testing. If all the above tests are converted to
+# run_make_test() syntax than this line can be removed.
+$makefile = undef;
+
+# -------------------------
+# Make sure that prefix characters apply properly to define/endef values.
+#
+# There's a bit of oddness here if you try to use a variable to hold the
+# prefix character for a define. Even though something like this:
+#
+# define foo
+# echo bar
+# endef
+#
+# all: ; $(V)$(foo)
+#
+# (where V=@) can be seen by the user to be obviously different than this:
+#
+# define foo
+# $(V)echo bar
+# endef
+#
+# all: ; $(foo)
+#
+# and the user thinks it should behave the same as when the "@" is literal
+# instead of in a variable, that can't happen because by the time make
+# expands the variables for the command line and sees it begins with a "@" it
+# can't know anymore whether the prefix character came before the variable
+# reference or was included in the first line of the variable reference.
+
+# TEST #5
+# -------
+
+run_make_test('
+define FOO
+$(V1)echo hello
+$(V2)echo world
+endef
+all: ; @$(FOO)
+', '', 'hello
+world');
+
+# TEST #6
+# -------
+
+run_make_test(undef, 'V1=@ V2=@', 'hello
+world');
+
+# TEST #7
+# -------
+
+run_make_test('
+define FOO
+$(V1)echo hello
+$(V2)echo world
+endef
+all: ; $(FOO)
+', 'V1=@', 'hello
+echo world
+world');
+
+# TEST #8
+# -------
+
+run_make_test(undef, 'V2=@', 'echo hello
+hello
+world');
+
+# TEST #9
+# -------
+
+run_make_test(undef, 'V1=@ V2=@', 'hello
+world');
1;