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 make(1): test parsing a makefile tha...



details:   https://anonhg.NetBSD.org/src/rev/b7b2a7a24101
branches:  trunk
changeset: 946721:b7b2a7a24101
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 06 19:00:48 2020 +0000

description:
make(1): test parsing a makefile that ends in a backslash

diffstat:

 usr.bin/make/unit-tests/opt-file.exp |   1 +
 usr.bin/make/unit-tests/opt-file.mk  |  11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r c692e4baf48d -r b7b2a7a24101 usr.bin/make/unit-tests/opt-file.exp
--- a/usr.bin/make/unit-tests/opt-file.exp      Sun Dec 06 18:38:58 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-file.exp      Sun Dec 06 19:00:48 2020 +0000
@@ -1,1 +1,2 @@
+value
 exit status 0
diff -r c692e4baf48d -r b7b2a7a24101 usr.bin/make/unit-tests/opt-file.mk
--- a/usr.bin/make/unit-tests/opt-file.mk       Sun Dec 06 18:38:58 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-file.mk       Sun Dec 06 19:00:48 2020 +0000
@@ -1,8 +1,17 @@
-# $NetBSD: opt-file.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt-file.mk,v 1.3 2020/12/06 19:00:48 rillig Exp $
 #
 # Tests for the -f command line option.
 
 # TODO: Implementation
 
+all: .PHONY file-ending-in-backslash
+
+# Passing '-' as the filename reads from stdin.  This is unusual but possible.
+#
+# In the unlikely case where a file ends in a backslash instead of a newline,
+# that backslash is trimmed.  See ParseGetLine.
+file-ending-in-backslash: .PHONY
+       @printf '%s' 'VAR=value\' | ${MAKE} -r -f - -v VAR
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index