diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-28 14:08:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-28 14:08:32 +0000 |
commit | bdfc701b85b3109d5954ff05fc61ec3e0bbb58e3 (patch) | |
tree | 0e623d7bbfef693d5435aefc6a23e06abe6672af /test/ruby/test_time_tz.rb | |
parent | 337b4b634495f247711cb25636364cc7f967e457 (diff) | |
download | ruby-bdfc701b85b3109d5954ff05fc61ec3e0bbb58e3.tar.gz |
Timezone at Time.at
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_time_tz.rb')
-rw-r--r-- | test/ruby/test_time_tz.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb index 5360666d3c..777f02bed9 100644 --- a/test/ruby/test_time_tz.rb +++ b/test/ruby/test_time_tz.rb @@ -544,6 +544,18 @@ module TestTimeTZ::WithTZ assert_equal(time_class.utc(2018, 9, 1, 12+h, m, s), t) end + def subtest_at(time_class, tz, tzarg, tzname, abbr, utc_offset) + h, m = (utc_offset / 60).divmod(60) + utc = time_class.utc(2018, 9, 1, 12, 0, 0) + t = time_class.at(utc, tzarg) + assert_equal([2018, 9, 1, 12+h, m, 0, tz], [t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.zone]) + assert_equal(utc.to_i, t.to_i) + utc = utc.to_i + t = time_class.at(utc, tzarg) + assert_equal([2018, 9, 1, 12+h, m, 0, tz], [t.year, t.mon, t.mday, t.hour, t.min, t.sec, t.zone]) + assert_equal(utc, t.to_i) + end + def subtest_marshal(time_class, tz, tzarg, tzname, abbr, utc_offset) t = time_class.new(2018, 9, 1, 12, 0, 0, tzarg) t2 = Marshal.load(Marshal.dump(t)) |