diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-07 02:55:35 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-07 02:55:35 +0000 |
commit | 1bb1d096fbd5d5b79539aa5ff9bf53bca87fe686 (patch) | |
tree | 2dd4d7a1554bca1a249dacfc07585f17139056bb /test | |
parent | 68300e95545d9b7d9c2c7a922cc6377a42c1f8a1 (diff) | |
download | ruby-1bb1d096fbd5d5b79539aa5ff9bf53bca87fe686.tar.gz |
* time.c (time_mdump): dump timezone string to private instance variable
on marshaling.
* time.c (time_mload): load timezone string from private instance
variable named 'zone'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_time.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 094a5af68a..c4ffccedad 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -290,6 +290,21 @@ class TestTime < Test::Unit::TestCase assert_equal(29700, t2.utc_offset, bug) end + def test_marshal_zone + orig_zone = ENV['TZ'] + + t = Time.utc(2013, 2, 24) + assert_equal('UTC', t.zone) + assert_equal('UTC', Marshal.load(Marshal.dump(t)).zone) + + ENV['TZ'] = 'Asia/Tokyo' + t = Time.local(2013, 2, 24) + assert_equal('JST', Time.local(2013, 2, 24).zone) + assert_equal('JST', Marshal.load(Marshal.dump(t)).zone) + ensure + ENV['TZ'] = orig_zone + end + def test_marshal_to_s t1 = Time.new(2011,11,8, 0,42,25, 9*3600) t2 = Time.at(Marshal.load(Marshal.dump(t1))) |