diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-30 07:34:23 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-30 07:34:23 +0000 |
commit | fdec8bb0b30a6c28c7ef4569880b2faf4519c9af (patch) | |
tree | 88849175f562adb9d076935c51715a173af0eb0f /test | |
parent | 29fdecfe829258d8cadfaad7e0484a746b1dfdf2 (diff) |
merge revision(s) 45364,45395,45396,45403,45406: [Backport #9652]
* time.c (time_mload): freeze and preserve marshal-loaded time zone
* test/ruby/test_time.rb: add test for GC on loaded object
[Bug #9652]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45752 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 02ebc6ac38..188ec0da04 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -311,6 +311,21 @@ class TestTime < Test::Unit::TestCase end end + def test_marshal_zone_gc + assert_separately(%w(--disable-gems), <<-'end;', timeout: 30) + ENV["TZ"] = "JST-9" + s = Marshal.dump(Time.now) + t = Marshal.load(s) + n = 0 + done = 100000 + while t.zone.dup == "JST" && n < done + n += 1 + end + assert_equal done, n, "Bug #9652" + assert_equal "JST", t.zone, "Bug #9652" + end; + 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))) |