ruby-changes:59831
From: Koichi <ko1@a...>
Date: Tue, 28 Jan 2020 15:24:38 +0900 (JST)
Subject: [ruby-changes:59831] ac2b945bc0 (master): support multi-run for test/ruby/test_marshal.rb
https://git.ruby-lang.org/ruby.git/commit/?id=ac2b945bc0 From ac2b945bc0182859ea538dc6b02ad6945a5cf212 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Tue, 28 Jan 2020 13:48:36 +0900 Subject: support multi-run for test/ruby/test_marshal.rb need to remove Constants. diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index dbeee82..1d096ad 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -596,7 +596,8 @@ class TestMarshal < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_marshal.rb#L596 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_marshal.rb#L606 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_marshal.rb#L623 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/