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

* error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when

ignore exception under rb_protect().

* test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
  add a corresponding test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2011-12-13 14:50:12 +00:00
parent ab6c8910f4
commit d61d9d5e8e
3 changed files with 29 additions and 1 deletions

View file

@ -1,4 +1,5 @@
require 'test/unit'
require 'tempfile'
require_relative 'envutil'
class TestException < Test::Unit::TestCase
@ -363,4 +364,20 @@ end.join
assert_equal(false, efs.success?, bug5728)
assert_equal("msg", efs.message, bug5728)
end
def test_exception_in_name_error_to_str
bug5575 = '[ruby-core:41612]'
t = Tempfile.new(["test_exception_in_name_error_to_str", ".rb"])
t.puts <<-EOC
begin
BasicObject.new.inspect
rescue
$!.inspect
end
EOC
t.close
assert_nothing_raised(NameError, bug5575) do
load(t.path)
end
end
end