Skip to content

Commit 639bd4f

Browse files
committed
Make the spec pass whether there is a rescue in line or not
* It only happens on CRuby: https://bugs.ruby-lang.org/issues/20275
1 parent dca8008 commit 639bd4f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

spec/ruby/core/exception/top_level_spec.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ def raise_wrapped
2121
RUBY
2222
lines = ruby_exe(code, args: "2>&1", exit_status: 1).lines
2323
lines.map! { |l| l.chomp[/:(in.+)/, 1] }
24-
lines.size.should == 5
25-
lines[0].should =~ /\Ain [`'](?:Object#)?raise_wrapped': wrapped \(RuntimeError\)\z/
26-
lines[1].should =~ /\Ain [`'](?:rescue in )?<main>'\z/
27-
lines[2].should =~ /\Ain [`']<main>'\z/
28-
lines[3].should =~ /\Ain [`'](?:Object#)?raise_cause': the cause \(RuntimeError\)\z/
29-
lines[4].should =~ /\Ain [`']<main>'\z/
24+
expected = [
25+
/\Ain [`'](?:Object#)?raise_wrapped': wrapped \(RuntimeError\)\z/,
26+
# https://bugs.ruby-lang.org/issues/20275
27+
*(/\Ain [`'](?:rescue in )?<main>'\z/ if RUBY_ENGINE == 'ruby'),
28+
/\Ain [`']<main>'\z/,
29+
/\Ain [`'](?:Object#)?raise_cause': the cause \(RuntimeError\)\z/,
30+
/\Ain [`']<main>'\z/,
31+
]
32+
lines.size.should == expected.size
33+
lines.zip(expected) { |l,e| l.should =~ e }
3034
end
3135

3236
describe "with a custom backtrace" do

0 commit comments

Comments
 (0)