summaryrefslogtreecommitdiff
path: root/tests/scripts
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2010-11-06 21:56:23 +0000
committerPaul Smith <psmith@gnu.org>2010-11-06 21:56:23 +0000
commit391456aad790172c3cbbceb5544dd785c0e60a99 (patch)
treefaf87797baba5fae47c98029e5d2c1ec741fb7d1 /tests/scripts
parenta86d1693bac05e04f90a2ee3c4fa3547c788377c (diff)
downloadgunmake-391456aad790172c3cbbceb5544dd785c0e60a99.tar.gz
Improve backslash/newline handling to adhere to POSIX requirements.
Diffstat (limited to 'tests/scripts')
-rw-r--r--tests/scripts/features/targetvars2
-rw-r--r--tests/scripts/functions/call2
-rw-r--r--tests/scripts/misc/bs-nl76
-rw-r--r--tests/scripts/variables/special2
4 files changed, 79 insertions, 3 deletions
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