Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests Add a test for backslash-newline at ...
details: https://anonhg.NetBSD.org/src/rev/00aa9e627c5c
branches: trunk
changeset: 332160:00aa9e627c5c
user: apb <apb%NetBSD.org@localhost>
date: Tue Sep 09 10:22:27 2014 +0000
description:
Add a test for backslash-newline at the very end of a command script.
diffstat:
usr.bin/make/unit-tests/escape.exp | 4 ++++
usr.bin/make/unit-tests/escape.mk | 13 ++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diffs (41 lines):
diff -r 460fbeecfb31 -r 00aa9e627c5c usr.bin/make/unit-tests/escape.exp
--- a/usr.bin/make/unit-tests/escape.exp Tue Sep 09 10:11:20 2014 +0000
+++ b/usr.bin/make/unit-tests/escape.exp Tue Sep 09 10:22:27 2014 +0000
@@ -71,6 +71,10 @@
only one tab should be elided, second tab remains'
:first line\
only one tab should be elided, second tab remains
+cmd-1bsnl-eof
+echo :'command ending with backslash-newline'; \
+
+:command ending with backslash-newline
cmd-2bsnl
echo take one\\
take one\
diff -r 460fbeecfb31 -r 00aa9e627c5c usr.bin/make/unit-tests/escape.mk
--- a/usr.bin/make/unit-tests/escape.mk Tue Sep 09 10:11:20 2014 +0000
+++ b/usr.bin/make/unit-tests/escape.mk Tue Sep 09 10:22:27 2014 +0000
@@ -1,4 +1,4 @@
-# $Id: escape.mk,v 1.9 2014/09/09 10:11:20 apb Exp $
+# $Id: escape.mk,v 1.10 2014/09/09 10:22:27 apb Exp $
#
# Test backslash escaping.
@@ -204,6 +204,17 @@
echo :'first line\
only one tab should be elided, second tab remains'
+# When backslash-newline appears at the end of a command script,
+# both the backslash and the newline should be passed to the shell.
+# The shell should elide the backslash-newline.
+#
+all: cmd-1bsnl-eof
+cmd-1bsnl-eof:
+ @echo ${.TARGET}
+ echo :'command ending with backslash-newline'; \
+
+# above line must be blank
+
# Double-backslash-newline in a command.
# Both backslashes are retained, but the newline is not escaped.
# XXX: This may differ from POSIX, but matches gmake.
Home |
Main Index |
Thread Index |
Old Index