2010-11-07 05:56:23 +08:00
|
|
|
# -*-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
|
2012-03-04 02:45:08 +08:00
|
|
|
run_make_test(q!
|
|
|
|
var = he\
|
|
|
|
llo
|
|
|
|
var:;@echo '|$(var)|'!,
|
2010-11-07 05:56:23 +08:00
|
|
|
'', "|he llo|");
|
|
|
|
|
2012-03-04 02:45:08 +08:00
|
|
|
# Condense trailing space
|
|
|
|
run_make_test(q!
|
|
|
|
var = he \
|
|
|
|
llo
|
|
|
|
var:;@echo '|$(var)|'!,
|
|
|
|
'', "|he llo|");
|
2010-11-07 05:56:23 +08:00
|
|
|
|
|
|
|
# Remove leading space
|
2012-03-04 02:45:08 +08:00
|
|
|
run_make_test(q!
|
|
|
|
var = he\
|
|
|
|
llo
|
|
|
|
var:;@echo '|$(var)|'!,
|
|
|
|
'', "|he llo|");
|
|
|
|
|
|
|
|
# Multiple bs/nl condensed
|
|
|
|
run_make_test(q!
|
|
|
|
var = he\
|
|
|
|
\
|
|
|
|
\
|
|
|
|
llo
|
|
|
|
var:;@echo '|$(var)|'!,
|
2010-11-07 05:56:23 +08:00
|
|
|
'', "|he llo|");
|
|
|
|
|
2012-03-04 02:45:08 +08:00
|
|
|
# POSIX: Preserve trailing space
|
|
|
|
run_make_test(q!
|
|
|
|
.POSIX:
|
|
|
|
x = y
|
|
|
|
var = he \
|
|
|
|
llo
|
|
|
|
var:;@echo '|$(var)|'!,
|
|
|
|
'', "|he llo|");
|
|
|
|
|
|
|
|
# POSIX: One space per bs-nl
|
|
|
|
run_make_test(q!
|
|
|
|
.POSIX:
|
|
|
|
x = y
|
|
|
|
var = he\
|
|
|
|
\
|
|
|
|
\
|
|
|
|
llo
|
|
|
|
var:;@echo '|$(var)|'!,
|
2010-11-07 05:56:23 +08:00
|
|
|
'', "|he llo|");
|
|
|
|
|
|
|
|
1;
|