# # # add_dir "tests/date_formatting" # # add_file "tests/date_formatting/__driver__.lua" # content [79b3dfd647ed2d7b20e034b6694824d1f4c5c6e6] # # patch "std_hooks.lua" # from [52aa565e0f7dad93d2e7fd0ffef4ac9d9ee7a9a6] # to [c9dd3ea46238ea2899e6d450154bca73f971547b] # # patch "testlib.lua" # from [05262d080af7a5505620fbbeec4ea527eec435d4] # to [5807919b1b0111e8e2bacdc6589bb0d43eddae42] # # patch "tests/_--author,_--date/__driver__.lua" # from [7fd3ac3cb95874381f43dd1182a23bc22dd02b5a] # to [32996584305ed55d69e88dd14f0570e6da40b827] # # patch "tests/log_--brief/__driver__.lua" # from [e693530a91048029954b4dc66a6caca1973ca08c] # to [5fe08b4182a0dd9349743363da14eb0c4582fcea] # # patch "tests/test_hooks.lua" # from [2352f60b89c450fbfd3df9a419d9ab7828d55244] # to [33fa5ede0f6a84f7b4d8c2432a45e135ac5af936] # ============================================================ --- tests/date_formatting/__driver__.lua 79b3dfd647ed2d7b20e034b6694824d1f4c5c6e6 +++ tests/date_formatting/__driver__.lua 79b3dfd647ed2d7b20e034b6694824d1f4c5c6e6 @@ -0,0 +1,57 @@ +mtn_setup() +addfile("testfile", "floooooo") +check(mtn("commit", "--date=1999-12-31T13:00:00", + "--branch=B", "--message=blah-blah"), 0, false, false) +rev = base_revision() + +function logdf(fmt) + if fmt then + return mtn("log", "--brief", "--no-graph", "--date-format="..fmt) + else + return mtn("log", "--brief", "--no-graph") + end +end + +function test_tz_fmt(tz, fmt, exp) + if tz then + set_env("TZ", tz) + end + check(logdf(fmt), 0, true, false) + check(samelines("stdout", { rev .. " address@hidden " .. exp .. " B" })) +end + +test_tz_fmt(nil, nil, "1999-12-31T13:00:00") +test_tz_fmt(nil, "%Y-%m-%d %H:%M:%S", "1999-12-31 13:00:00") +test_tz_fmt(nil, "%Y-%m-%d %I:%M:%S", "1999-12-31 01:00:00") +test_tz_fmt(nil, "%a, %d %b %Y %T", "Fri, 31 Dec 1999 13:00:00") + +-- TZ env var doesn't work +skip_if(ostype=="Windows") + +test_tz_fmt("ZZT+00:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 13:00 ZZT+0000") +test_tz_fmt("ZZT+01:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 12:00 ZZT-0100") +test_tz_fmt("ZZT+02:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 11:00 ZZT-0200") +test_tz_fmt("ZZT+03:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 10:00 ZZT-0300") +test_tz_fmt("ZZT+04:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 09:00 ZZT-0400") +test_tz_fmt("ZZT+05:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 08:00 ZZT-0500") +test_tz_fmt("ZZT+06:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 07:00 ZZT-0600") +test_tz_fmt("ZZT+07:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 06:00 ZZT-0700") +test_tz_fmt("ZZT+08:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 05:00 ZZT-0800") +test_tz_fmt("ZZT+09:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 04:00 ZZT-0900") +test_tz_fmt("ZZT+10:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 03:00 ZZT-1000") +test_tz_fmt("ZZT+11:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 02:00 ZZT-1100") +test_tz_fmt("ZZT+12:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 01:00 ZZT-1200") + +test_tz_fmt("ZZT-00:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 13:00 ZZT+0000") +test_tz_fmt("ZZT-01:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 14:00 ZZT+0100") +test_tz_fmt("ZZT-02:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 15:00 ZZT+0200") +test_tz_fmt("ZZT-03:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 16:00 ZZT+0300") +test_tz_fmt("ZZT-04:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 17:00 ZZT+0400") +test_tz_fmt("ZZT-05:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 18:00 ZZT+0500") +test_tz_fmt("ZZT-06:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 19:00 ZZT+0600") +test_tz_fmt("ZZT-07:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 20:00 ZZT+0700") +test_tz_fmt("ZZT-08:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 21:00 ZZT+0800") +test_tz_fmt("ZZT-09:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 22:00 ZZT+0900") +test_tz_fmt("ZZT-10:00", "%Y-%m-%d %H:%M %Z%z", "1999-12-31 23:00 ZZT+1000") +test_tz_fmt("ZZT-11:00", "%Y-%m-%d %H:%M %Z%z", "2000-01-01 00:00 ZZT+1100") +test_tz_fmt("ZZT-12:00", "%Y-%m-%d %H:%M %Z%z", "2000-01-01 01:00 ZZT+1200") ============================================================ --- std_hooks.lua 52aa565e0f7dad93d2e7fd0ffef4ac9d9ee7a9a6 +++ std_hooks.lua c9dd3ea46238ea2899e6d450154bca73f971547b @@ -384,6 +384,8 @@ function get_date_format_spec() -- like ctime(3): "%a %b %d %H:%M:%S %Y" -- email style: "%a, %d %b %Y %H:%M:%S" -- ISO 8601: "%Y-%m-%d %H:%M:%S" or "%Y-%m-%dT%H:%M:%S" + -- + -- ISO 8601, no timezone conversion: "" end -- trust evaluation hooks ============================================================ --- testlib.lua 05262d080af7a5505620fbbeec4ea527eec435d4 +++ testlib.lua 5807919b1b0111e8e2bacdc6589bb0d43eddae42 @@ -876,6 +876,9 @@ function run_tests(debugging, list_only, unset_env("EDITOR") unset_env("VISUAL") + -- tests should not be timezone sensitive + set_env("TZ", "UTC") + logfile = io.open(logname, "w") chdir(run_dir); ============================================================ --- tests/_--author,_--date/__driver__.lua 7fd3ac3cb95874381f43dd1182a23bc22dd02b5a +++ tests/_--author,_--date/__driver__.lua 32996584305ed55d69e88dd14f0570e6da40b827 @@ -4,7 +4,7 @@ rev = base_revision() addfile("testfile", "floooooo") check(mtn("commit", "--author=the_author", "--date=1999-12-31T12:00:00", "--branch=foo", "--message=foo"), 0, false, false) rev = base_revision() -check(mtn("log", "--from", rev, "--no-format-dates"), 0, true, false) +check(mtn("log", "--from", rev), 0, true, false) check(qgrep('^[\\| ]+Author: the_author', "stdout")) check(qgrep('^[\\| ]+Date: 1999-12-31T12:00:00', "stdout")) ============================================================ --- tests/log_--brief/__driver__.lua e693530a91048029954b4dc66a6caca1973ca08c +++ tests/log_--brief/__driver__.lua 5fe08b4182a0dd9349743363da14eb0c4582fcea @@ -13,7 +13,7 @@ R2=base_revision() check(mtn("commit", "-b", "otherbranch", "--date", "2005-08-16T03:16:05", "-m", "foo"), 0, false, false) R2=base_revision() -check(mtn("log", "--brief", "--no-graph", "--no-format-dates"), 0, true, false) +check(mtn("log", "--brief", "--no-graph"), 0, true, false) check(samelines("stdout", {R2.." address@hidden 2005-08-16T03:16:05 otherbranch", R1.." address@hidden 2005-08-16T03:16:00 testbranch", R0.." address@hidden 2005-08-16T03:16:00 testbranch"})) ============================================================ --- tests/test_hooks.lua 2352f60b89c450fbfd3df9a419d9ab7828d55244 +++ tests/test_hooks.lua 33fa5ede0f6a84f7b4d8c2432a45e135ac5af936 @@ -57,6 +57,10 @@ end return "address@hidden" end +function get_date_format_spec() + return "" +end + function ignore_file(name) if (string.find(name, "ts-std", 1, true)) then return true end if (string.find(name, "testsuite.log")) then return true end