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 the :gmtime mo...



details:   https://anonhg.NetBSD.org/src/rev/840eaebf14ee
branches:  trunk
changeset: 937067:840eaebf14ee
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 08 13:09:55 2020 +0000

description:
make(1): add test for the :gmtime modifier with indirect time

diffstat:

 usr.bin/make/unit-tests/modmisc.exp |   3 +++
 usr.bin/make/unit-tests/modmisc.mk  |  13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diffs (47 lines):

diff -r b8f6a687fe86 -r 840eaebf14ee usr.bin/make/unit-tests/modmisc.exp
--- a/usr.bin/make/unit-tests/modmisc.exp       Sat Aug 08 13:05:24 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.exp       Sat Aug 08 13:09:55 2020 +0000
@@ -107,6 +107,9 @@
 2020
 %Y
 %Y
+mod-gmtime-indirect:
+make: Unknown modifier '1'
+
 mod-localtime:
 %Y
 2020
diff -r b8f6a687fe86 -r 840eaebf14ee usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Sat Aug 08 13:05:24 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Sat Aug 08 13:09:55 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.35 2020/08/08 13:03:13 rillig Exp $
+# $Id: modmisc.mk,v 1.36 2020/08/08 13:09:55 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -30,6 +30,7 @@
 all:   mod-break-many-words
 all:   mod-remember
 all:   mod-gmtime
+all:   mod-gmtime-indirect
 all:   mod-localtime
 all:   mod-hash
 all:   mod-range
@@ -295,6 +296,16 @@
        @echo ${%Y:L:gmtimer=1593536400}        # modifier name too long
        @echo ${%Y:L:gm=gm:M*}
 
+mod-gmtime-indirect:
+       @echo $@:
+       # It's not possible to pass the seconds via a variable expression.
+       # Parsing of the :gmtime modifier stops at the '$' and returns to
+       # ApplyModifiers.  There, a colon would be skipped but not a dollar.
+       # Parsing continues by looking at the next modifier.  Now the ${:U}
+       # is expanded and interpreted as a variable modifier, which results
+       # in the error message "Unknown modifier '1'".
+       @echo ${%Y:L:gmtime=${:U1593536400}}
+
 mod-localtime:
        @echo $@:
        @echo ${%Y:L:localtim=1593536400}       # modifier name too short



Home | Main Index | Thread Index | Old Index