aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_marshal.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-20 05:22:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-20 05:22:25 +0000
commit8c77e58b97465ebfef0d94497a5eecd78f5bef3c (patch)
treed4e7ee7b916e8d10d4e95877dac7f12829d10a65 /test/ruby/test_marshal.rb
parent1e8a05c1dfee94db9b6b825097e1d192ad32930a (diff)
downloadruby-8c77e58b97465ebfef0d94497a5eecd78f5bef3c.tar.gz
marshal.c: use ivars of marshal_dump data
* marshal.c (w_object): dump no ivars to the original by marshal_dump. [ruby-core:54334] [Bug #8276] * marshal.c (r_object0): copy all ivars of marshal_dump data to the result object instead. [ruby-core:51163] [Bug #7627] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_marshal.rb')
-rw-r--r--test/ruby/test_marshal.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index baf143bcfb..6d610b3a28 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -553,10 +553,18 @@ class TestMarshal < Test::Unit::TestCase
bug8276 = '[ruby-core:54334] [Bug #8276]'
t = Bug8276.new(bug8276)
s = Marshal.dump(t)
- assert_nothing_raised(RuntimeError) {s = Marshal.load(s)}
+ assert_nothing_raised(RuntimeError, bug8276) {s = Marshal.load(s)}
assert_equal(t.data, s.data, bug8276)
end
+ def test_marshal_dump_ivar
+ s = "data with ivar"
+ s.instance_variable_set(:@t, 42)
+ t = Bug8276.new(s)
+ s = Marshal.dump(t)
+ assert_raise(RuntimeError) {Marshal.load(s)}
+ end
+
def test_class_ivar
assert_raise(TypeError) {Marshal.load("\x04\x08Ic\x1bTestMarshal::TestClass\x06:\x0e@ivar_bug\"\x08bug")}
assert_raise(TypeError) {Marshal.load("\x04\x08IM\x1bTestMarshal::TestClass\x06:\x0e@ivar_bug\"\x08bug")}