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 default time f...



details:   https://anonhg.NetBSD.org/src/rev/5c6245b3eb4d
branches:  trunk
changeset: 941740:5c6245b3eb4d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 29 18:59:43 2020 +0000

description:
make(1): add test for default time format of the :gmtime modifier

diffstat:

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

diffs (24 lines):

diff -r a9ee291e8949 -r 5c6245b3eb4d usr.bin/make/unit-tests/varmod-gmtime.mk
--- a/usr.bin/make/unit-tests/varmod-gmtime.mk  Thu Oct 29 18:38:24 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-gmtime.mk  Thu Oct 29 18:59:43 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-gmtime.mk,v 1.2 2020/08/16 12:48:55 rillig Exp $
+# $NetBSD: varmod-gmtime.mk,v 1.3 2020/10/29 18:59:43 rillig Exp $
 #
 # Tests for the :gmtime variable modifier, which formats a timestamp
 # using strftime(3).
@@ -6,6 +6,14 @@
 all:   mod-gmtime
 all:   mod-gmtime-indirect
 
+# Test for the default time format, %c.  Since the time always varies, it's
+# only possible to check for the general format here.  The names of the
+# month and weekday are always in English, independent from the locale.
+# Example: Thu Oct 29 18:56:41 2020
+.if ${:U:gmtime:tW:M??? ??? ?? ??\:??\:?? ????} == ""
+.  error
+.endif
+
 mod-gmtime:
        @echo $@:
        @echo ${%Y:L:gmtim=1593536400}          # modifier name too short



Home | Main Index | Thread Index | Old Index