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 parsing the :?...



details:   https://anonhg.NetBSD.org/src/rev/bc7f4371a512
branches:  trunk
changeset: 976932:bc7f4371a512
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 09 07:03:20 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/varmod-ifelse.mk |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (26 lines):

diff -r 6c21f4d72e3a -r bc7f4371a512 usr.bin/make/unit-tests/varmod-ifelse.mk
--- a/usr.bin/make/unit-tests/varmod-ifelse.mk  Fri Oct 09 06:44:42 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-ifelse.mk  Fri Oct 09 07:03:20 2020 +0000
@@ -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:
        @:;



Home | Main Index | Thread Index | Old Index