1
0
Fork 0
mirror of https://github.com/rubyjs/therubyrhino synced 2023-03-27 23:21:34 -04:00

align spec (backtrace generation) with latest JRuby 1.7.12

This commit is contained in:
kares 2014-07-15 18:27:49 +02:00
parent a2e907ae25
commit cccf922f03

View file

@ -78,12 +78,12 @@ describe Rhino::JSError do
begin
Rhino::Context.eval "throw 42"
rescue => e
# [ "at <eval>:1", "at org/mozilla/javascript/gen/<eval>:1" ]
e.javascript_backtrace.should be_a Enumerable
e.javascript_backtrace.size.should == 1
e.javascript_backtrace.size.should >= 1
e.javascript_backtrace[0].should == "at <eval>:1"
e.javascript_backtrace(true).should be_a Enumerable
e.javascript_backtrace(true).size.should == 1
e.javascript_backtrace(true).size.should >= 1
element = e.javascript_backtrace(true)[0]
element.file_name.should == '<eval>'
element.function_name.should be nil
@ -97,9 +97,9 @@ describe Rhino::JSError do
begin
Rhino::Context.eval "function fortyTwo() { throw 42 }\n fortyTwo()"
rescue => e
e.javascript_backtrace.size.should == 2
e.javascript_backtrace.size.should >= 2
e.javascript_backtrace[0].should == "at <eval>:1 (fortyTwo)"
e.javascript_backtrace[1].should == "at <eval>:2"
expect( e.javascript_backtrace.find { |trace| trace == "at <eval>:2" } ).to_not be nil
else
fail "expected to rescue"
end