summaryrefslogtreecommitdiff
path: root/tests/scripts/misc/bs-nl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/misc/bs-nl')
-rw-r--r--tests/scripts/misc/bs-nl76
1 files changed, 76 insertions, 0 deletions
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;