File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
spec/truffle/interop/polyglot Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 13
13
@foreign = Truffle ::Debug . foreign_exception ( "exception message" )
14
14
end
15
15
16
+ it "subclasses Exception" do
17
+ @foreign . class . should == Polyglot ::ForeignException
18
+ @foreign . class . superclass . should == Exception
19
+ end
20
+
16
21
it "supports #message" do
17
22
@foreign . message . should == "exception message"
18
23
end
21
26
@foreign . cause . should == nil
22
27
end
23
28
29
+ it "supports #full_message" do
30
+ -> {
31
+ raise @foreign
32
+ } . should raise_error ( Polyglot ::ForeignException ) {
33
+ full_message = @foreign . full_message ( highlight : false , order : :top ) . lines
34
+ full_message [ 0 ] . should == "#{ __FILE__ } :#{ __LINE__ -3 } :in `Kernel#raise': exception message (Polyglot::ForeignException)\n "
35
+ }
36
+ end
37
+
24
38
it "supports rescue Polyglot::ForeignException" do
25
39
begin
26
40
raise @foreign
29
43
end
30
44
end
31
45
46
+ it "supports rescue Exception" do
47
+ begin
48
+ raise @foreign
49
+ rescue Exception => e # rubocop:disable Lint/RescueException
50
+ e . should . equal? ( @foreign )
51
+ end
52
+ end
53
+
32
54
it "supports rescue Object" do
33
55
begin
34
56
raise @foreign
You can’t perform that action at this time.
0 commit comments