Skip to content

Commit 828d8c4

Browse files
committed
Get fixes for tzdata-2022g for test_time_tz.rb
* From ruby/ruby@58cc3c9 * The latest labsjdk-ce-17 seems to use tzdata-2022g.
1 parent daab02f commit 828d8c4

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

test/mri/tests/ruby/test_time_tz.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ class TestTimeTZ < Test::Unit::TestCase
77
has_lisbon_tz = true
88
force_tz_test = ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes"
99
case RUBY_PLATFORM
10-
when /linux/
10+
when /darwin|linux/
1111
force_tz_test = true
12-
when /darwin|freebsd|openbsd/
12+
when /freebsd|openbsd/
1313
has_lisbon_tz = false
1414
force_tz_test = true
1515
end
@@ -95,6 +95,9 @@ def group_by(e, &block)
9595
CORRECT_KIRITIMATI_SKIP_1994 = with_tz("Pacific/Kiritimati") {
9696
Time.local(1994, 12, 31, 0, 0, 0).year == 1995
9797
}
98+
CORRECT_SINGAPORE_1982 = with_tz("Asia/Singapore") {
99+
"2022g" if Time.local(1981, 12, 31, 23, 59, 59).utc_offset == 8*3600
100+
}
98101

99102
def time_to_s(t)
100103
t.to_s
@@ -112,7 +115,7 @@ def test_localtime_zone
112115
t = with_tz("America/Los_Angeles") {
113116
Time.local(2000, 1, 1)
114117
}
115-
skip "force_tz_test is false on this environment" unless t
118+
omit "force_tz_test is false on this environment" unless t
116119
z1 = t.zone
117120
z2 = with_tz(tz="Asia/Singapore") {
118121
t.localtime.zone
@@ -140,9 +143,12 @@ def test_america_managua
140143

141144
def test_asia_singapore
142145
with_tz(tz="Asia/Singapore") {
143-
assert_time_constructor(tz, "1981-12-31 23:59:59 +0730", :local, [1981,12,31,23,59,59])
144-
assert_time_constructor(tz, "1982-01-01 00:30:00 +0800", :local, [1982,1,1,0,0,0])
145-
assert_time_constructor(tz, "1982-01-01 00:59:59 +0800", :local, [1982,1,1,0,29,59])
146+
assert_time_constructor(tz, "1981-12-31 23:29:59 +0730", :local, [1981,12,31,23,29,59])
147+
if CORRECT_SINGAPORE_1982
148+
assert_time_constructor(tz, "1982-01-01 00:00:00 +0800", :local, [1981,12,31,23,30,00])
149+
assert_time_constructor(tz, "1982-01-01 00:00:00 +0800", :local, [1982,1,1,0,0,0])
150+
assert_time_constructor(tz, "1982-01-01 00:29:59 +0800", :local, [1982,1,1,0,29,59])
151+
end
146152
assert_time_constructor(tz, "1982-01-01 00:30:00 +0800", :local, [1982,1,1,0,30,0])
147153
}
148154
end
@@ -450,8 +456,11 @@ def self.gen_zdump_test(data)
450456
America/Managua Wed Jan 1 04:59:59 1997 UTC = Tue Dec 31 23:59:59 1996 EST isdst=0 gmtoff=-18000
451457
America/Managua Wed Jan 1 05:00:00 1997 UTC = Tue Dec 31 23:00:00 1996 CST isdst=0 gmtoff=-21600
452458
Asia/Singapore Sun Aug 8 16:30:00 1965 UTC = Mon Aug 9 00:00:00 1965 SGT isdst=0 gmtoff=27000
453-
Asia/Singapore Thu Dec 31 16:29:59 1981 UTC = Thu Dec 31 23:59:59 1981 SGT isdst=0 gmtoff=27000
459+
Asia/Singapore Thu Dec 31 15:59:59 1981 UTC = Thu Dec 31 23:29:59 1981 SGT isdst=0 gmtoff=27000
454460
Asia/Singapore Thu Dec 31 16:30:00 1981 UTC = Fri Jan 1 00:30:00 1982 SGT isdst=0 gmtoff=28800
461+
End
462+
gen_zdump_test <<'End' if CORRECT_SINGAPORE_1982
463+
Asia/Singapore Thu Dec 31 16:00:00 1981 UTC = Fri Jan 1 00:00:00 1982 SGT isdst=0 gmtoff=28800
455464
End
456465
gen_zdump_test CORRECT_TOKYO_DST_1951 ? <<'End' + (CORRECT_TOKYO_DST_1951 < "2018f" ? <<'2018e' : <<'2018f') : <<'End'
457466
Asia/Tokyo Sat May 5 14:59:59 1951 UTC = Sat May 5 23:59:59 1951 JST isdst=0 gmtoff=32400

0 commit comments

Comments
 (0)