summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-25 08:41:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-25 08:41:07 +0000
commit003c45f9cd570335b7360241724b6967a8ab014a (patch)
treee4bd8551fcfb97f8f2e1b34a1915e14933a8088e /test/ruby
parent681c1b9f1b86f2a1198229e40cfa64bbd52e02f9 (diff)
complex.c, rational.c: compatible marshal loader
* complex.c, rational.c: compatible marshal loader for compatibilities with 1.8. [ruby-core:45775] [Bug #6625] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_complex.rb15
-rw-r--r--test/ruby/test_rational.rb15
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