Module Name: src Committed By: rillig Date: Tue Sep 29 18:48:43 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: varmod-defined.mk Log Message: make(1): add test for using the :D variable modifier as comment To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/varmod-defined.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/unit-tests/varmod-defined.mk diff -u src/usr.bin/make/unit-tests/varmod-defined.mk:1.5 src/usr.bin/make/unit-tests/varmod-defined.mk:1.6 --- src/usr.bin/make/unit-tests/varmod-defined.mk:1.5 Sat Sep 12 07:04:51 2020 +++ src/usr.bin/make/unit-tests/varmod-defined.mk Tue Sep 29 18:48:43 2020 @@ -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 @@ DEF= defined . 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.