diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 8 | ||||
-rw-r--r-- | tests/scripts/features/targetvars | 2 | ||||
-rw-r--r-- | tests/scripts/functions/call | 2 | ||||
-rw-r--r-- | tests/scripts/misc/bs-nl | 76 | ||||
-rw-r--r-- | tests/scripts/variables/special | 2 |
5 files changed, 87 insertions, 3 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 527ecd8..b13e2ae 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2010-11-06 Paul Smith <psmith@gnu.org> + + * scripts/features/targetvars: Fix known-good output for BS/NL changes. + * scripts/functions/call: Ditto. + * scripts/variables/special: Ditto. + + * scripts/misc/bs-nl: New test suite for backslash/newline testing. + 2010-08-29 Paul Smith <psmith@gnu.org> * scripts/features/errors: Add new error message to output text. diff --git a/tests/scripts/features/targetvars b/tests/scripts/features/targetvars index ddd6c1f..6afd48a 100644 --- a/tests/scripts/features/targetvars +++ b/tests/scripts/features/targetvars @@ -240,7 +240,7 @@ run_make_test(undef, 'FOO=C', "C f1\n"); # TEST #20: Check for continuation after semicolons run_make_test(q! -a: A = 'hello; \ +a: A = 'hello;\ world' a: ; @echo $(A) !, diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call index f3c5470..6dd48b1 100644 --- a/tests/scripts/functions/call +++ b/tests/scripts/functions/call @@ -38,7 +38,7 @@ two = $(call one,$(1),foo,$(2)) DEP_foo = bar baz quux DEP_baz = quux blarp rest = $(wordlist 2,$(words ${1}),${1}) -tclose = $(if $1,$(firstword $1) \ +tclose = $(if $1,$(firstword $1)\ $(call tclose,$(sort ${DEP_$(firstword $1)} $(call rest,$1)))) all: ; @echo '$(call reverse,bar,foo)'; \ diff --git a/tests/scripts/misc/bs-nl b/tests/scripts/misc/bs-nl new file mode 100644 index 0000000..979abb5 --- /dev/null +++ b/tests/scripts/misc/bs-nl @@ -0,0 +1,76 @@ +# -*-perl-*- +$description = "Test backslash-newline handling."; + +$details = ""; + +# TEST #1 +# ------- + +# Backslash-newlines in recipes + +# These are basic backslash-newlines with no tricks +run_make_test("fast:;\@echo fa\\\nst\n", + '', 'fast'); + +run_make_test("slow:;\@: no-op; echo sl\\\now\n", + '', 'slow'); + +run_make_test("dquote:;\@echo \"dqu\\\note\"\n", + '', 'dquote'); + +run_make_test("squote:;\@echo 'squ\\\note'\n", + '', "squ\\\note"); + +# Ensure that a leading prefix character is omitted +run_make_test("fast:;\@echo fa\\\n\tst\n", + '', 'fast'); + +run_make_test("slow:;\@: no-op; echo sl\\\n\tow\n", + '', 'slow'); + +run_make_test("dquote:;\@echo \"dqu\\\n\tote\"\n", + '', 'dquote'); + +run_make_test("squote:;\@echo 'squ\\\n\tote'\n", + '', "squ\\\note"); + +# Ensure that ONLY the leading prefix character is omitted +run_make_test("fast:;\@echo fa\\\n\t st\n", + '', 'fa st'); + +run_make_test("slow:;\@: no-op; echo sl\\\n\t\tow\n", + '', "sl ow"); + +run_make_test("dquote:;\@echo \"dqu\\\n\t ote\"\n", + '', 'dqu ote'); + +run_make_test("squote:;\@echo 'squ\\\n\t\t ote'\n", + '', "squ\\\n\t ote"); + +# Backslash-newlines in variable values + +# Simple +run_make_test(" +var = he\\\nllo +var:;\@echo '|\$(var)|'", + '', "|he llo|"); + +# Preserve preceding space +run_make_test(" +var = he \\\nllo +var:;\@echo '|\$(var)|'", + '', "|he llo|"); + +# Remove leading space +run_make_test(" +var = he\\\n llo +var:;\@echo '|\$(var)|'", + '', "|he llo|"); + +# One space per bs-nl +run_make_test(" +var = he\\\n\\\n\\\n llo +var:;\@echo '|\$(var)|'", + '', "|he llo|"); + +1; diff --git a/tests/scripts/variables/special b/tests/scripts/variables/special index a1e15c2..4637b2a 100644 --- a/tests/scripts/variables/special +++ b/tests/scripts/variables/special @@ -53,7 +53,7 @@ all: # Test the .RECIPEPREFIX variable &run_make_test(' define foo -: foo-one \ +: foo-one\ foo-two : foo-three : foo-four |