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

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
This commit is contained in:
nobu 2018-04-12 03:40:16 +00:00
parent aa2b32ae4b
commit 2e501b0a8b

View file

@ -110,7 +110,9 @@ module MarshalTestLib
class MyException < Exception; def initialize(v, *args) super(*args); @v = v; end; attr_reader :v; end class MyException < Exception; def initialize(v, *args) super(*args); @v = v; end; attr_reader :v; end
def test_exception def test_exception
marshal_equal(Exception.new('foo')) {|o| o.message} 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 end
def test_exception_subclass def test_exception_subclass