| @@ -1,9 +1,17 @@ | | | @@ -1,9 +1,17 @@ |
1 | # $NetBSD: varmod-localtime.mk,v 1.3 2020/08/23 15:13:21 rillig Exp $ | | 1 | # $NetBSD: varmod-localtime.mk,v 1.4 2020/10/29 19:01:10 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for the :localtime variable modifier, which returns the given time, | | 3 | # Tests for the :localtime variable modifier, which returns the given time, |
4 | # formatted as a local timestamp. | | 4 | # formatted as a local timestamp. |
5 | | | 5 | |
| | | 6 | # Test for the default time format, %c. Since the time always varies, it's |
| | | 7 | # only possible to check for the general format here. The names of the |
| | | 8 | # month and weekday are always in English, independent from the locale. |
| | | 9 | # Example: Thu Oct 29 18:56:41 2020 |
| | | 10 | .if ${:U:localtime:tW:M??? ??? ?? ??\:??\:?? ????} == "" |
| | | 11 | . error |
| | | 12 | .endif |
| | | 13 | |
6 | all: | | 14 | all: |
7 | @echo ${%Y:L:localtim=1593536400} # modifier name too short | | 15 | @echo ${%Y:L:localtim=1593536400} # modifier name too short |
8 | @echo ${%Y:L:localtime=1593536400} # 2020-07-01T00:00:00Z | | 16 | @echo ${%Y:L:localtime=1593536400} # 2020-07-01T00:00:00Z |
9 | @echo ${%Y:L:localtimer=1593536400} # modifier name too long | | 17 | @echo ${%Y:L:localtimer=1593536400} # modifier name too long |