#!/usr/bin/env bash test_description="date/time parser module" . ./test-lib.sh # This is currently just a quick sanity/smoke test. _date () { date -d "$*" +%s } _parse_time () { ${TEST_DIRECTORY}/parse-time --format=%s "$*" } test_begin_subtest "date(1) default format without TZ code" test_expect_equal "$(_parse_time Fri Aug 3 23:06:06 2012)" "$(_date Fri Aug 3 23:06:06 2012)" test_begin_subtest "date(1) --rfc-2822 format" test_expect_equal "$(_parse_time Fri, 03 Aug 2012 23:07:46 +0100)" "$(_date Fri, 03 Aug 2012 23:07:46 +0100)" test_begin_subtest "date(1) --rfc=3339=seconds format" test_expect_equal "$(_parse_time 2012-08-03 23:09:37+03:00)" "$(_date 2012-08-03 23:09:37+03:00)" test_done