mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add test for [ruby-dev:31759].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d790c7c802
commit
89e1e1e784
1 changed files with 12 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue