Sha256: 3c59d47a22213aaef1073a7ba12ef466ec21a96689ee787c77cd1e2dded1d077

Contents?: true

Size: 1.08 KB

Versions: 34

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe V8::C::Template do

  describe V8::C::FunctionTemplate do
    it "can be created with no arguments" do
      t = V8::C::FunctionTemplate::New()
      t.GetFunction().Call(@cxt.Global(),[]).StrictEquals(@cxt.Global()).should be_true
    end

    it "can be created with a callback" do
      receiver = V8::C::Object::New()
      f = nil
      callback = lambda do |arguments|
        arguments.Length().should be(2)
        arguments[0].Utf8Value().should eql 'one'
        arguments[1].Utf8Value().should eql 'two'
        arguments.Callee().StrictEquals(f).should be_true
        arguments.This().StrictEquals(receiver).should be_true
        arguments.Holder().StrictEquals(receiver).should be_true
        arguments.IsConstructCall().should be_false
        arguments.Data().Value().should be(42)
        V8::C::String::New("result")
      end
      t = V8::C::FunctionTemplate::New(callback, V8::C::External::New(42))
      f = t.GetFunction()
      f.Call(receiver, [V8::C::String::New('one'), V8::C::String::New('two')]).Utf8Value().should eql "result"
    end
  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/template_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/spec/c/template_spec.rb
therubyracer-tmpfork-0.12.2 spec/c/template_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/spec/c/template_spec.rb
therubyracer-0.12.2 spec/c/template_spec.rb
therubyracer-0.12.1 spec/c/template_spec.rb
therubyracer-discourse-0.12.0 spec/c/template_spec.rb
therubyracer-0.12.0 spec/c/template_spec.rb
therubyracer-0.11.4 spec/c/template_spec.rb
therubyracer-0.11.3 spec/c/template_spec.rb
therubyracer-0.11.2 spec/c/template_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/spec/c/template_spec.rb
therubyracer-0.11.1 spec/c/template_spec.rb
therubyracer-0.11.1beta1 spec/c/template_spec.rb
therubyracer-0.11.0 spec/c/template_spec.rb
therubyracer-0.11.0beta8-x86-freebsd-9 spec/c/template_spec.rb
therubyracer-0.11.0beta8-x86_64-linux spec/c/template_spec.rb
therubyracer-0.11.0beta8-x86-linux spec/c/template_spec.rb
therubyracer-0.11.0beta8 spec/c/template_spec.rb
therubyracer-0.11.0beta7-x86_64-linux spec/c/template_spec.rb