From fc035fe32147b8de4b07d80cf61f03995d3269ca Mon Sep 17 00:00:00 2001 From: tadf Date: Tue, 16 Sep 2008 10:21:23 +0000 Subject: * complex.c (nucomp_marshal_{dump,load}): preserve instance variables. * rational.c (nurat_marshal_{dump,load}): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_complex.rb | 2 ++ test/ruby/test_rational.rb | 2 ++ 2 files changed, 4 insertions(+) (limited to 'test') diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index 493e2e2c3..af2311ca0 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -638,10 +638,12 @@ class Complex_Test < Test::Unit::TestCase def test_marshal c = Complex(1,2) + c.instance_eval{@ivar = 9} s = Marshal.dump(c) c2 = Marshal.load(s) assert_equal(c, c2) + assert_equal(9, c2.instance_variable_get(:@ivar)) assert_instance_of(Complex, c2) if defined?(Rational) diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index 1d280e436..de8c31dbc 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -854,10 +854,12 @@ class Rational_Test < Test::Unit::TestCase def test_marshal c = Rational(1,2) + c.instance_eval{@ivar = 9} s = Marshal.dump(c) c2 = Marshal.load(s) assert_equal(c, c2) + assert_equal(9, c2.instance_variable_get(:@ivar)) assert_instance_of(Rational, c2) assert_raise(ZeroDivisionError){ -- cgit