Fix for circular causes

* eval_error.c (show_cause): get rid of infinite recursion on
  circular causes.  [Bug #15447]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-12-22 07:14:14 +00:00
parent 65dced4320
commit 1849288722
2 changed files with 33 additions and 6 deletions

View file

@ -1353,6 +1353,19 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
assert_in_out_err([], code, [], /foo/, success: false, timeout: 2)
end
def test_circular_cause_handle
errs = [/.*error 1.*\n/, /.*error 2.*\n/, /.*error 1.*/m]
assert_in_out_err([], "#{<<~"begin;"}\n#{<<~'end;'}", [], errs, success: false, timeout: 2)
begin;
begin
raise "error 1"
rescue => e1
raise "error 2" rescue e2 = $!
raise e1, cause: e2
end
end;
end
def test_super_in_method_missing
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;