diff options
author | Paul Smith <psmith@gnu.org> | 2010-11-06 21:56:23 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2010-11-06 21:56:23 +0000 |
commit | 391456aad790172c3cbbceb5544dd785c0e60a99 (patch) | |
tree | faf87797baba5fae47c98029e5d2c1ec741fb7d1 /tests/scripts/misc | |
parent | a86d1693bac05e04f90a2ee3c4fa3547c788377c (diff) | |
download | gunmake-391456aad790172c3cbbceb5544dd785c0e60a99.tar.gz |
Improve backslash/newline handling to adhere to POSIX requirements.
Diffstat (limited to 'tests/scripts/misc')
-rw-r--r-- | tests/scripts/misc/bs-nl | 76 |
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; |