t0006: check --date=format zone offsets
[gitweb.git] / t / t0006-date.sh
index fded9dbd686150fdfb31c023d6ccad476205e8b8..4b789c00f1227ecd35b8ce500441ca9a4982b56f 100755 (executable)
@@ -31,9 +31,11 @@ check_show () {
        format=$1
        time=$2
        expect=$3
-       test_expect_success $4 "show date ($format:$time)" '
+       prereqs=$4
+       zone=$5
+       test_expect_success $prereqs "show date ($format:$time)" '
                echo "$time -> $expect" >expect &&
-               test-date show:$format "$time" >actual &&
+               TZ=${zone:-$TZ} test-date show:"$format" "$time" >actual &&
                test_cmp expect actual
        '
 }
@@ -57,6 +59,9 @@ check_show 'format:%Z' "$TIME" ''
 check_show 'format:%%z' "$TIME" '%z'
 check_show 'format-local:%%z' "$TIME" '%z'
 
+check_show 'format:%Y-%m-%d %H:%M:%S' "$TIME" '2016-06-15 16:13:20'
+check_show 'format-local:%Y-%m-%d %H:%M:%S' "$TIME" '2016-06-15 09:13:20' '' EST5
+
 # arbitrary time absurdly far in the future
 FUTURE="5758122296 -0400"
 check_show iso       "$FUTURE" "2152-06-19 18:24:56 -0400" LONG_IS_64BIT