Module Name:    src
Committed By:   rillig
Date:           Fri Oct  9 07:03:20 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: varmod-ifelse.mk

Log Message:
make(1): add test for parsing the :? variable modifier


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-ifelse.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-ifelse.mk
diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.3 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.4
--- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.3	Fri Oct  2 20:34:59 2020
+++ src/usr.bin/make/unit-tests/varmod-ifelse.mk	Fri Oct  9 07:03:20 2020
@@ -1,12 +1,19 @@
-# $NetBSD: varmod-ifelse.mk,v 1.3 2020/10/02 20:34:59 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.4 2020/10/09 07:03:20 rillig Exp $
 #
 # Tests for the ${cond:?then:else} variable modifier, which evaluates either
 # the then-expression or the else-expression, depending on the condition.
 
 # TODO: Implementation
 
-# TODO: Test another modifier after ifelse; does not work, it becomes part
-# of the else branch.
+# When the :? is parsed, it is greedy.  The else branch spans all the
+# text, up until the closing character '}', even if the text looks like
+# another modifier.
+.if ${1:?then:else:Q} != "then"
+.  error
+.endif
+.if ${0:?then:else:Q} != "else:Q"
+.  error
+.endif
 
 all:
 	@:;

Reply via email to