summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-05 06:35:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-05 06:35:07 +0000
commitfffd5a383355ad05b00f59fb7c442d632996af56 (patch)
tree41b62895491f6a5c88ef6ae5990f9d2c24e3c109 /test
parent47d01e35ae59c469666854ff80de7951e02b4296 (diff)
downloadruby-fffd5a383355ad05b00f59fb7c442d632996af56.tar.gz
ruby-fffd5a383355ad05b00f59fb7c442d632996af56.tar.xz
ruby-fffd5a383355ad05b00f59fb7c442d632996af56.zip
* marshal.c (w_object): dump instance variables when using
marshal_dump. [ruby-core:24211] * variable.c (rb_ivar_count): added. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@26007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_marshal.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 0b37b7ab1..71936ec14 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -310,4 +310,24 @@ class TestMarshal < Test::Unit::TestCase
Marshal.dump(Object.new, w)
assert_not_empty(w, bug2390)
end
+
+ class C5
+ def marshal_dump
+ "foo"
+ end
+ def marshal_load(foo)
+ @foo = foo
+ end
+ def initialize(x)
+ @x = x
+ end
+ end
+ def test_marshal_dump
+ bug1744 = '[ruby-core:24211]'
+ c = C5.new("bar")
+ s = Marshal.dump(c)
+ d = Marshal.load(s)
+ assert_equal("foo", d.instance_variable_get(:@foo), bug1744)
+ assert_equal("bar", d.instance_variable_get(:@x), bug1744)
+ end
end