Skip to content

Commit d6ae601

Browse files
committed
Port r63054,r63055,r63056 for Kiritimati tzdata fix
1 parent df31801 commit d6ae601

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

test/ruby/test_time_tz.rb

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def group_by(e, &block)
9191
end
9292
end
9393
}
94+
CORRECT_KIRITIMATI_SKIP_1994 = with_tz("Pacific/Kiritimati") {
95+
Time.local(1994, 12, 31, 0, 0, 0).year == 1995
96+
}
9497

9598
def time_to_s(t)
9699
t.to_s
@@ -180,9 +183,17 @@ def test_europe_lisbon
180183

181184
def test_pacific_kiritimati
182185
with_tz(tz="Pacific/Kiritimati") {
183-
assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
184-
assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
185-
assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
186+
assert_time_constructor(tz, "1994-12-30 00:00:00 -1000", :local, [1994,12,30,0,0,0])
187+
assert_time_constructor(tz, "1994-12-30 23:59:59 -1000", :local, [1994,12,30,23,59,59])
188+
if CORRECT_KIRITIMATI_SKIP_1994
189+
assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1994,12,31,0,0,0])
190+
assert_time_constructor(tz, "1995-01-01 23:59:59 +1400", :local, [1994,12,31,23,59,59])
191+
assert_time_constructor(tz, "1995-01-01 00:00:00 +1400", :local, [1995,1,1,0,0,0])
192+
else
193+
assert_time_constructor(tz, "1994-12-31 23:59:59 -1000", :local, [1994,12,31,23,59,59])
194+
assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,1,0,0,0])
195+
assert_time_constructor(tz, "1995-01-02 23:59:59 +1400", :local, [1995,1,1,23,59,59])
196+
end
186197
assert_time_constructor(tz, "1995-01-02 00:00:00 +1400", :local, [1995,1,2,0,0,0])
187198
}
188199
end
@@ -370,9 +381,18 @@ def self.gen_zdump_test(data)
370381
Europe/London Sun Aug 10 01:00:00 1947 UTC = Sun Aug 10 02:00:00 1947 BST isdst=1 gmtoff=3600
371382
Europe/London Sun Nov 2 01:59:59 1947 UTC = Sun Nov 2 02:59:59 1947 BST isdst=1 gmtoff=3600
372383
Europe/London Sun Nov 2 02:00:00 1947 UTC = Sun Nov 2 02:00:00 1947 GMT isdst=0 gmtoff=0
384+
End
385+
if CORRECT_KIRITIMATI_SKIP_1994
386+
gen_zdump_test <<'End'
387+
Pacific/Kiritimati Sat Dec 31 09:59:59 1994 UTC = Fri Dec 30 23:59:59 1994 LINT isdst=0 gmtoff=-36000
388+
Pacific/Kiritimati Sat Dec 31 10:00:00 1994 UTC = Sun Jan 1 00:00:00 1995 LINT isdst=0 gmtoff=50400
389+
End
390+
else
391+
gen_zdump_test <<'End'
373392
Pacific/Kiritimati Sun Jan 1 09:59:59 1995 UTC = Sat Dec 31 23:59:59 1994 LINT isdst=0 gmtoff=-36000
374393
Pacific/Kiritimati Sun Jan 1 10:00:00 1995 UTC = Mon Jan 2 00:00:00 1995 LINT isdst=0 gmtoff=50400
375394
End
395+
end
376396
gen_zdump_test <<'End' if has_right_tz
377397
right/America/Los_Angeles Fri Jun 30 23:59:60 1972 UTC = Fri Jun 30 16:59:60 1972 PDT isdst=1 gmtoff=-25200
378398
right/America/Los_Angeles Wed Dec 31 23:59:60 2008 UTC = Wed Dec 31 15:59:60 2008 PST isdst=0 gmtoff=-28800
@@ -420,5 +440,6 @@ def self.gen_variational_zdump_test(hint, data)
420440
gen_variational_zdump_test "lisbon", <<'End' if has_lisbon_tz
421441
Europe/Lisbon Mon Jan 1 00:36:31 1912 UTC = Sun Dec 31 23:59:59 1911 LMT isdst=0 gmtoff=-2192
422442
Europe/Lisbon Mon Jan 1 00:36:44 1912 UT = Sun Dec 31 23:59:59 1911 LMT isdst=0 gmtoff=-2205
443+
Europe/Lisbon Sun Dec 31 23:59:59 1911 UT = Sun Dec 31 23:23:14 1911 LMT isdst=0 gmtoff=-2205
423444
End
424445
end

0 commit comments

Comments
 (0)