diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_complex.rb | 15 | ||||
-rw-r--r-- | test/ruby/test_rational.rb | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index aa6d6a77fe..adf4a01b2d 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -658,14 +658,15 @@ class Complex_Test < Test::Unit::TestCase end bug3656 = '[ruby-core:31622]' - assert_raise(TypeError, bug3656) { - Complex(1,2).marshal_load(0) - } + assert_not_respond_to(Complex(1,2), :marshal_load, bug3656) + end - c = Complex(1,2) - c.freeze - assert(c.frozen?) - assert_raise(RuntimeError){c.marshal_load([2,3])} + def test_marshal_compatibility + bug6625 = '[ruby-core:45775]' + dump = "\x04\x08o:\x0cComplex\x07:\x0a@reali\x06:\x0b@imagei\x07" + assert_nothing_raised(bug6625) do + assert_equal(Complex(1, 2), Marshal.load(dump), bug6625) + end end def test_parse diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb index e1aafb5a0a..cc5ca9a750 100644 --- a/test/ruby/test_rational.rb +++ b/test/ruby/test_rational.rb @@ -828,14 +828,15 @@ class Rational_Test < Test::Unit::TestCase } bug3656 = '[ruby-core:31622]' - assert_raise(TypeError, bug3656) { - Rational(1,2).marshal_load(0) - } + assert_not_respond_to(Rational(1,2), :marshal_load, bug3656) + end - c = Rational(1,2) - c.freeze - assert(c.frozen?) - assert_raise(RuntimeError){c.marshal_load([2,3])} + def test_marshal_compatibility + bug6625 = '[ruby-core:45775]' + dump = "\x04\x08o:\x0dRational\x07:\x11@denominatori\x07:\x0f@numeratori\x06" + assert_nothing_raised(bug6625) do + assert_equal(Rational(1, 2), Marshal.load(dump), bug6625) + end end def test_parse |