aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-08-04 10:12:51 -0700
committerRob Landley <rob@landley.net>2020-08-04 22:38:38 -0500
commit397677b55ba7c089302a816ca4677b64b76909c6 (patch)
tree74ede51f37abb6f586d01ecafa8568d3d9e432f4
parentd75a535e000db6eda21275858e4f41fa1591e692 (diff)
downloadtoybox-397677b55ba7c089302a816ca4677b64b76909c6.tar.gz
date.test: add more UTC offset tests.
Rob's code supports more formats than mine did, so add the extra tests.
-rw-r--r--tests/date.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/date.test b/tests/date.test
index 5cb9f038..7dd125d7 100644
--- a/tests/date.test
+++ b/tests/date.test
@@ -58,9 +58,18 @@ testing "TZ=" "TZ='America/Los_Angeles' date -d 'TZ=\"Europe/Berlin\" 2018-01-04
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" "" ""
testing "TZ= @" "TZ='America/Los_Angeles' date -d 'TZ=\"GMT\" @1533427200'" "Sat Aug 4 17:00:00 PDT 2018\n" "" ""
+# Test all supported UTC offset variants.
testing "tz Z" \
"date -u -d 2020-08-01T12:34:56Z" "Sat Aug 1 12:34:56 UTC 2020\n" "" ""
+testing "tz -0800" \
+ "date -u -d 2020-08-01T12:34:56-0800" "Sat Aug 1 20:34:56 UTC 2020\n" "" ""
testing "tz +0800" \
"date -u -d 2020-08-01T12:34:56+0800" "Sat Aug 1 04:34:56 UTC 2020\n" "" ""
testing "tz +08:00" \
"date -u -d 2020-08-01T12:34:56+08:00" "Sat Aug 1 04:34:56 UTC 2020\n" "" ""
+testing "tz +8" \
+ "date -u -d 2020-08-01T12:34:56+8" "Sat Aug 1 04:34:56 UTC 2020\n" "" ""
+testing "tz +08" \
+ "date -u -d 2020-08-01T12:34:56+08" "Sat Aug 1 04:34:56 UTC 2020\n" "" ""
+testing "tz +008" \
+ "date -u -d 2020-08-01T12:34:56+008" "Sat Aug 1 12:26:56 UTC 2020\n" "" ""