diff options
Diffstat (limited to 'tests/scripts/misc/bs-nl')
-rw-r--r-- | tests/scripts/misc/bs-nl | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/scripts/misc/bs-nl b/tests/scripts/misc/bs-nl index 4fc3f63..fc323ce 100644 --- a/tests/scripts/misc/bs-nl +++ b/tests/scripts/misc/bs-nl @@ -125,5 +125,103 @@ close(MAKEFILE); run_make_with_options($m2, '', get_logfile()); compare_output("foo bar\n", get_logfile(1)); +# Test different types of whitespace, and bsnl inside functions + +sub xlate +{ + $_ = $_[0]; + s/\\r/\r/g; + s/\\t/\t/g; + s/\\f/\f/g; + s/\\v/\v/g; + s/\\n/\n/g; + return $_; +} + +run_make_test(xlate(q! +$(foreach\r a \t , b\t c \r ,$(info $a \r ) ) +all:;@: +!), + '', "b \r \nc \r \n"); + +run_make_test(xlate(q! +all:;@:$(foreach\r a \t , b\t c \r ,$(info $a \r ) ) +!), + '', "b \r \nc \r \n"); + +run_make_test(xlate(q! +$(foreach \ +\r a \t\ + , b\t \ + c \r ,$(info \ + $a \r ) \ + ) +all:;@: +!), + '', "b \r \nc \r \n"); + +run_make_test(xlate(q! +all:;@:$(foreach \ +\r a \t\ + , b\t \ + c \r ,$(info \ + $a \r ) \ + ) +!), + '', "b \r \nc \r \n"); + +run_make_test(xlate(q! +define FOO +$(foreach +\r a \t + , b\t + c \r ,$(info + $a \r ) + ) +endef +$(FOO) +all:;@: +!), + '', "b \r \nc \r \n"); + +run_make_test(xlate(q! +define FOO +$(foreach +\r a \t + , b\t + c \r ,$(info + $a \r ) + ) +endef +all:;@:$(FOO) +!), + '', "b \r \nc \r \n"); + +# Test variables in recipes that expand to multiple lines + +run_make_test(q! +define var + +echo foo + + +echo bar +endef +all:;$(var) +!, + '', "echo foo\nfoo\necho bar\nbar\n"); + +run_make_test(q! +define var + +echo foo + +@ + +echo bar +endef +all:;$(var) +!, + '', "echo foo\nfoo\necho bar\nbar\n"); 1; |