diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-05 06:35:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-05 06:35:07 +0000 |
commit | 1cc1ea378a0912bfcbe55399369da47a724427aa (patch) | |
tree | 41b62895491f6a5c88ef6ae5990f9d2c24e3c109 /test | |
parent | 7b154ee93e66ab894e68080a6fa3b5ae6f14f93e (diff) | |
download | ruby-1cc1ea378a0912bfcbe55399369da47a724427aa.tar.gz |
* marshal.c (w_object): dump instance variables when using
marshal_dump. [ruby-core:24211]
* variable.c (rb_ivar_count): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_marshal.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 0b37b7ab17..71936ec147 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 |