Skip to content

Commit fc841b3

Browse files
committed
Add spec for foreign exceptions reaching the top level
1 parent 9a1b347 commit fc841b3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
slow:Polyglot::ForeignException when reaching the top-level is printed like a Ruby exception

spec/truffle/interop/polyglot/foreign_exception_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,16 @@
8989
entry.label.should.is_a?(String)
9090
end
9191
end
92+
93+
describe "when reaching the top-level" do
94+
it "is printed like a Ruby exception" do
95+
out = ruby_exe('raise Truffle::Debug.foreign_exception "main"', args: "2>&1", exit_status: 1, escape: false)
96+
out.should == "-e:1:in `Kernel#raise': main (Polyglot::ForeignException)\n" \
97+
"\tfrom -e:1:in `<main>'\n"
98+
99+
out = ruby_exe('at_exit { raise Truffle::Debug.foreign_exception "at exit" }', args: "2>&1", exit_status: 1, escape: false)
100+
out.should == "-e:1:in `Kernel#raise': at exit (Polyglot::ForeignException)\n" \
101+
"\tfrom -e:1:in `block in <main>'\n"
102+
end
103+
end
92104
end

0 commit comments

Comments
 (0)