From 397677b55ba7c089302a816ca4677b64b76909c6 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 4 Aug 2020 10:12:51 -0700 Subject: date.test: add more UTC offset tests. Rob's code supports more formats than mine did, so add the extra tests. --- tests/date.test | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') 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" "" "" -- cgit v1.2.3