aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-11-14 15:02:43 -0800
committerRob Landley <rob@landley.net>2020-11-15 02:45:48 -0600
commit1377dd2221010b67fdf9127ce41fa2dbefe94b98 (patch)
treef4e094d05d8124be9cfc75ac374a2bc574493490 /tests
parent52bbc1e0a410b44a926b04aaae3b00f9f50da81e (diff)
downloadtoybox-1377dd2221010b67fdf9127ce41fa2dbefe94b98.tar.gz
date: add --iso and the %:z output format.
I didn't know until implementing this that --iso is actually called --iso-8601 and that GNU date will actually accept any prefix. --iso-8 works fine too. I've assumed that --iso (that I always used) and --iso-8601 (as given in the documentation) are the only two that matter.
Diffstat (limited to 'tests')
-rw-r--r--tests/date.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/date.test b/tests/date.test
index 9240131a..6aaf937e 100644
--- a/tests/date.test
+++ b/tests/date.test
@@ -53,6 +53,21 @@ testing "trailing %" "touch -d 2012-01-23T12:34:56.123456789 f && date -r f +%Y%
testing "just %" "touch -d 2012-01-23T12:34:56.123456789 f && date -r f +%" "%\n" "" ""
rm -f f
+# Test --iso...
+testing "-I" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -I" \
+ "2012-01-23\n" "" ""
+testing "-Id" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Id" \
+ "2012-01-23\n" "" ""
+testing "-Ih" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Ih" \
+ "2012-01-23T12+00:00\n" "" ""
+testing "-Im" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Im" \
+ "2012-01-23T12:34+00:00\n" "" ""
+testing "-Is" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -Is" \
+ "2012-01-23T12:34:56+00:00\n" "" ""
+testing "-In" "touch -d 2012-01-23T12:34:56.123456789Z f && date -r f -u -In" \
+ "2012-01-23T12:34:56,123456789+00:00\n" "" ""
+rm -f f
+
# Test embedded TZ to take a date in one time zone and display it in another.
testing "TZ=" "TZ='America/Los_Angeles' date -d 'TZ=\"Europe/Berlin\" 2018-01-04 08:00'" "Wed Jan 3 23:00:00 PST 2018\n" "" ""
testing "TZ=" "TZ='America/Los_Angeles' date -d 'TZ=\"Europe/Berlin\" 2018-10-04 08:00'" "Wed Oct 3 23:00:00 PDT 2018\n" "" ""