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): add test for the .newline v...
details: https://anonhg.NetBSD.org/src/rev/32d8bd12df6f
branches: trunk
changeset: 942768:32d8bd12df6f
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Aug 19 05:51:18 2020 +0000
description:
make(1): add test for the .newline variable
diffstat:
usr.bin/make/unit-tests/varname-dot-newline.exp | 3 +++
usr.bin/make/unit-tests/varname-dot-newline.mk | 21 ++++++++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r aae66827a5a3 -r 32d8bd12df6f usr.bin/make/unit-tests/varname-dot-newline.exp
--- a/usr.bin/make/unit-tests/varname-dot-newline.exp Wed Aug 19 05:40:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-newline.exp Wed Aug 19 05:51:18 2020 +0000
@@ -1,1 +1,4 @@
+make: "varname-dot-newline.mk" line 16: The .newline variable can be overwritten. Just don't do that.
+first
+second
exit status 0
diff -r aae66827a5a3 -r 32d8bd12df6f usr.bin/make/unit-tests/varname-dot-newline.mk
--- a/usr.bin/make/unit-tests/varname-dot-newline.mk Wed Aug 19 05:40:06 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-newline.mk Wed Aug 19 05:51:18 2020 +0000
@@ -1,8 +1,23 @@
-# $NetBSD: varname-dot-newline.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-newline.mk,v 1.3 2020/08/19 05:51:18 rillig Exp $
#
# Tests for the special .newline variable.
+#
+# Contrary to the special variable named "" that is used in expressions like
+# ${:Usome-value}, the variable ".newline" is not protected against
+# modification. Nobody exploits that though.
-# TODO: Implementation
+NEWLINE:= ${.newline}
+
+.newline= overwritten
+
+.if ${.newline} == ${NEWLINE}
+.info The .newline variable cannot be overwritten. Good.
+.else
+.info The .newline variable can be overwritten. Just don't do that.
+.endif
+
+# Restore the original value.
+.newline= ${NEWLINE}
all:
- @:;
+ @echo 'first${.newline}second'
Home |
Main Index |
Thread Index |
Old Index