Sha256: 2ffc99357f1f0de2d79f33f1d0738b4c38093d7f586766724448620018c7bfb1
Contents?: true
Size: 673 Bytes
Versions: 3
Compression:
Stored size: 673 Bytes
Contents
require 'spec_helper' describe V8::C::Exception do requires_v8_context it "can be thrown from Ruby" do t = V8::C::FunctionTemplate::New(method(:explode)) @cxt.Global().Set("explode", t.GetFunction()) script = V8::C::Script::New(<<-JS, '<eval>') (function() { try { explode() } catch (e) { return e.message } })() JS result = script.Run() result.should_not be_nil result.should be_kind_of(V8::C::String) result.Utf8Value().should eql 'did not pay syntax' end def explode(arguments) error = V8::C::Exception::SyntaxError('did not pay syntax') V8::C::ThrowException(error) end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
therubyracer-0.12.3 | spec/c/exception_spec.rb |
therubyracer-xcode-0.12.3 | spec/c/exception_spec.rb |
therubyracer-xcode-0.12.2 | spec/c/exception_spec.rb |