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 tests/make: convert test for ':_' mo...



details:   https://anonhg.NetBSD.org/src/rev/1b6a873d7b7d
branches:  trunk
changeset: 953627:1b6a873d7b7d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 14 17:07:11 2021 +0000

description:
tests/make: convert test for ':_' modifier to parse time

diffstat:

 usr.bin/make/unit-tests/varmod-remember.exp |   2 --
 usr.bin/make/unit-tests/varmod-remember.mk  |  14 +++++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r d6eb3aac3f54 -r 1b6a873d7b7d usr.bin/make/unit-tests/varmod-remember.exp
--- a/usr.bin/make/unit-tests/varmod-remember.exp       Sun Mar 14 16:43:30 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-remember.exp       Sun Mar 14 17:07:11 2021 +0000
@@ -1,3 +1,1 @@
-1 2 3 1 2 3 1 2 3
-1 2 3, SAVED=3
 exit status 0
diff -r d6eb3aac3f54 -r 1b6a873d7b7d usr.bin/make/unit-tests/varmod-remember.mk
--- a/usr.bin/make/unit-tests/varmod-remember.mk        Sun Mar 14 16:43:30 2021 +0000
+++ b/usr.bin/make/unit-tests/varmod-remember.mk        Sun Mar 14 17:07:11 2021 +0000
@@ -1,12 +1,20 @@
-# $NetBSD: varmod-remember.mk,v 1.3 2020/08/23 15:18:43 rillig Exp $
+# $NetBSD: varmod-remember.mk,v 1.4 2021/03/14 17:07:11 rillig Exp $
 #
 # Tests for the :_ modifier, which saves the current variable value
 # in the _ variable or another, to be used later again.
 
+.if ${1 2 3:L:_:@var@${_}@} != "1 2 3 1 2 3 1 2 3"
+.  error
+.endif
+
 # In the parameterized form, having the variable name on the right side of
 # the = assignment operator is confusing.  In almost all other situations
 # the variable name is on the left-hand side of the = operator.  Luckily
 # this modifier is only rarely needed.
+.if ${1 2 3:L:@var@${var:_=SAVED:}@} != "1 2 3"
+.  error
+.elif ${SAVED} != "3"
+.  error
+.endif
+
 all:
-       @echo ${1 2 3:L:_:@var@${_}@}
-       @echo ${1 2 3:L:@var@${var:_=SAVED:}@}, SAVED=${SAVED}



Home | Main Index | Thread Index | Old Index