From 2e501b0a8bcd2753c8361ee0ac66ac2d398da4d2 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 12 Apr 2018 03:40:16 +0000 Subject: marshaltestlib.rb: use clean object for exception * test/ruby/marshaltestlib.rb (test_exception): use separate clean object to raise an exception. TestCase instance often has modules included. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/marshaltestlib.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/ruby/marshaltestlib.rb b/test/ruby/marshaltestlib.rb index 358d3c5133..5c48a8d853 100644 --- a/test/ruby/marshaltestlib.rb +++ b/test/ruby/marshaltestlib.rb @@ -110,7 +110,9 @@ module MarshalTestLib class MyException < Exception; def initialize(v, *args) super(*args); @v = v; end; attr_reader :v; end def test_exception marshal_equal(Exception.new('foo')) {|o| o.message} - marshal_equal(assert_raise(NoMethodError) {no_such_method()}) {|o| o.message} + obj = Object.new + e = assert_raise(NoMethodError) {obj.no_such_method()} + marshal_equal(e) {|o| o.message} end def test_exception_subclass -- cgit v1.2.3