Sha256: 5158e6bb786f1d628ba4eb5ac63eefb04a9ff598b3fd244fdd3ef2af20e96627

Contents?: true

Size: 881 Bytes

Versions: 34

Compression:

Stored size: 881 Bytes

Contents

# encoding: UTF-8
require 'spec_helper'

describe V8::C::Script do
  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_false
    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_true
  end
end

Version data entries

34 entries across 34 versions & 7 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/therubyracer-0.12.2/spec/c/script_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/spec/c/script_spec.rb
therubyracer-tmpfork-0.12.2 spec/c/script_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/spec/c/script_spec.rb
therubyracer-0.12.2 spec/c/script_spec.rb
therubyracer-0.12.1 spec/c/script_spec.rb
therubyracer-discourse-0.12.0 spec/c/script_spec.rb
therubyracer-0.12.0 spec/c/script_spec.rb
therubyracer-0.11.4 spec/c/script_spec.rb
therubyracer-0.11.3 spec/c/script_spec.rb
therubyracer-0.11.2 spec/c/script_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/spec/c/script_spec.rb
therubyracer-0.11.1 spec/c/script_spec.rb
therubyracer-0.11.1beta1 spec/c/script_spec.rb
therubyracer-0.11.0 spec/c/script_spec.rb
therubyracer-0.11.0beta8-x86-freebsd-9 spec/c/script_spec.rb
therubyracer-0.11.0beta8-x86_64-linux spec/c/script_spec.rb
therubyracer-0.11.0beta8-x86-linux spec/c/script_spec.rb
therubyracer-0.11.0beta8 spec/c/script_spec.rb
therubyracer-0.11.0beta7-x86_64-linux spec/c/script_spec.rb