diff options
Diffstat (limited to 'test/ruby/test_marshal.rb')
-rw-r--r-- | test/ruby/test_marshal.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 0565a1c04f..f6d84d181a 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -795,7 +795,11 @@ class TestMarshal < Test::Unit::TestCase end def marshal_dump - self.foo.baz = :problem + if self.foo.baz + self.foo.remove_instance_variable(:@baz) + else + self.foo.baz = :problem + end {foo: self.foo} end @@ -811,4 +815,12 @@ class TestMarshal < Test::Unit::TestCase Marshal.dump(obj) end end + + def test_marshal_dump_removing_instance_variable + obj = Bug15968.new + obj.baz = :Bug15968 + assert_raise_with_message(RuntimeError, /instance variable removed/) do + Marshal.dump(obj) + end + end end |