Sha256: 236735ab27916a446c12169377f6dae624efee21992ff7ed28ec4d8d2c1b4a2d
Contents?: true
Size: 908 Bytes
Versions: 3
Compression:
Stored size: 908 Bytes
Contents
# encoding: UTF-8 require 'spec_helper' describe V8::C::Script do requires_v8_context it "can run a script and return a polymorphic result" do source = V8::C::String::New("(new Array())") filename = V8::C::String::New("<eval>") script = V8::C::Script::New(source, filename) result = script.Run() result.should be_kind_of V8::C::Array end it "can accept precompiled script data" do source = "7 * 6" name = V8::C::String::New("<spec>") origin = V8::C::ScriptOrigin.new(name) data = V8::C::ScriptData::PreCompile(source, source.length) data.HasError().should be_falsey script = V8::C::Script::New(V8::C::String::New(source), origin, data) script.Run().should eql 42 end it "can detect errors in the script data" do source = "^ = ;" data = V8::C::ScriptData::PreCompile(source, source.length) data.HasError().should be_truthy end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
therubyracer-0.12.3 | spec/c/script_spec.rb |
therubyracer-xcode-0.12.3 | spec/c/script_spec.rb |
therubyracer-xcode-0.12.2 | spec/c/script_spec.rb |