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 using the :D v...



details:   https://anonhg.NetBSD.org/src/rev/44c71ae98c58
branches:  trunk
changeset: 955453:44c71ae98c58
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 29 18:48:43 2020 +0000

description:
make(1): add test for using the :D variable modifier as comment

diffstat:

 usr.bin/make/unit-tests/varmod-defined.mk |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r e53065e0eb5a -r 44c71ae98c58 usr.bin/make/unit-tests/varmod-defined.mk
--- a/usr.bin/make/unit-tests/varmod-defined.mk Tue Sep 29 18:44:30 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-defined.mk Tue Sep 29 18:48:43 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-defined.mk,v 1.5 2020/09/12 07:04:51 rillig Exp $
+# $NetBSD: varmod-defined.mk,v 1.6 2020/09/29 18:48:43 rillig Exp $
 #
 # Tests for the :D variable modifier, which returns the given string
 # if the variable is defined.  It is closely related to the :U modifier.
@@ -75,6 +75,13 @@
 .  error
 .endif
 
+# Since the variable with the empty name is never defined, the :D modifier
+# can be used to add comments in the middle of an expression.  That
+# expression always evaluates to an empty string.
+.if ${:D This is a comment. } != ""
+.  error
+.endif
+
 # TODO: Add more tests for parsing the plain text part, to cover each branch
 # of ApplyModifier_Defined.
 



Home | Main Index | Thread Index | Old Index