1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

support multi-run for test/ruby/test_marshal.rb

need to remove Constants.
This commit is contained in:
Koichi Sasada 2020-01-28 13:48:36 +09:00
parent 251930cea0
commit ac2b945bc0

View file

@ -596,7 +596,8 @@ class TestMarshal < Test::Unit::TestCase
end
def test_unloadable_data
c = eval("class Unloadable\u{23F0 23F3}<Time;;self;end")
name = "Unloadable\u{23F0 23F3}"
c = eval("class #{name} < Time;;self;end")
c.class_eval {
alias _dump_data _dump
undef _dump
@ -605,10 +606,16 @@ class TestMarshal < Test::Unit::TestCase
assert_raise_with_message(TypeError, /Unloadable\u{23F0 23F3}/) {
Marshal.load(d)
}
# cleanup
self.class.class_eval do
remove_const name
end
end
def test_unloadable_userdef
c = eval("class Userdef\u{23F0 23F3}<Time;self;end")
name = "Userdef\u{23F0 23F3}"
c = eval("class #{name} < Time;self;end")
class << c
undef _load
end
@ -616,6 +623,11 @@ class TestMarshal < Test::Unit::TestCase
assert_raise_with_message(TypeError, /Userdef\u{23F0 23F3}/) {
Marshal.load(d)
}
# cleanup
self.class.class_eval do
remove_const name
end
end
def test_unloadable_usrmarshal