diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-07 23:06:33 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-09-07 23:06:33 +0000 |
commit | 89e1e1e78400a4bd8c9f701a197e6f30d2bee74e (patch) | |
tree | 2895969e47a3d6ba2be78302fd8e01f2b628b8e6 | |
parent | d790c7c802b9e571e147b6c75cbe78405f040d0f (diff) | |
download | ruby-89e1e1e78400a4bd8c9f701a197e6f30d2bee74e.tar.gz |
add test for [ruby-dev:31759].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_marshal.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index 91a387dd45..d438ef4d85 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -38,10 +38,18 @@ class TestMarshal < Test::Unit::TestCase end def test_inconsistent_struct - TestMarshal.const_set :S, Struct.new(:a) - s = Marshal.dump(S.new(1)) - TestMarshal.instance_eval { remove_const :S } - TestMarshal.const_set :S, Class.new + TestMarshal.const_set :StructOrNot, Struct.new(:a) + s = Marshal.dump(StructOrNot.new(1)) + TestMarshal.instance_eval { remove_const :StructOrNot } + TestMarshal.const_set :StructOrNot, Class.new assert_raise(TypeError, "[ruby-dev:31709]") { Marshal.load(s) } end + + def test_struct_invalid_members + TestMarshal.const_set :StructInvalidMembers, Struct.new(:a) + Marshal.load("\004\bIc&TestMarshal::StructInvalidMembers\006:\020__members__\"\bfoo") + assert_raise(TypeError, "[ruby-dev:31759]") { + TestMarshal::StructInvalidMembers.members + } + end end |