summaryrefslogtreecommitdiff
path: root/test/ruby/test_time_tz.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_time_tz.rb')
-rw-r--r--test/ruby/test_time_tz.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
index 8e60cf44c5..9bba30e577 100644
--- a/test/ruby/test_time_tz.rb
+++ b/test/ruby/test_time_tz.rb
@@ -156,6 +156,12 @@ class TestTimeTZ < Test::Unit::TestCase
}
end
+ def test_asia_kuala_lumpur
+ with_tz(tz="Asia/Kuala_Lumpur") {
+ assert_time_constructor(tz, "1933-01-01 00:20:00 +0720", :local, [1933])
+ }
+ end
+
def test_canada_newfoundland
with_tz(tz="America/St_Johns") {
assert_time_constructor(tz, "2007-11-03 23:00:59 -0230", :new, [2007,11,3,23,0,59,:dst])
@@ -542,6 +548,8 @@ module TestTimeTZ::WithTZ
m, s = (4000-utc_offset).divmod(60)
h, m = m.divmod(60)
assert_equal(time_class.utc(2018, 9, 1, 12+h, m, s), t)
+ assert_equal(6, t.wday)
+ assert_equal(244, t.yday)
end
def subtest_at(time_class, tz, tzarg, tzname, abbr, utc_offset)
@@ -651,6 +659,16 @@ else
@tz ||= TZInfo::Timezone.get(tzname)
end
end
+
+ def test_fractional_second
+ x = Object.new
+ def x.local_to_utc(t); t + 8*3600; end
+ def x.utc_to_local(t); t - 8*3600; end
+
+ t1 = Time.new(2020,11,11,12,13,14.124r, '-08:00')
+ t2 = Time.new(2020,11,11,12,13,14.124r, x)
+ assert_equal(t1, t2)
+ end
end
begin