Sha256: 0aba52d0e33def555b8788eb4b235501406dbbc2117d7c9a8e0d189276fa4126

Contents?: true

Size: 681 Bytes

Versions: 23

Compression:

Stored size: 681 Bytes

Contents

require "#{File.dirname(__FILE__)}/../spec_helper.rb"

include V8

describe C::TryCatch do

  it "does not allow instance creation by default" do
    lambda {
     C::TryCatch.new 
    }.should raise_error
  end
  
  it "will do nothing if not passed a block" do
    C::TryCatch.try.should == nil
  end
  
  it "executes a block in the context of a C++ stack frame" do
    C::TryCatch.try do |catch|
      catch.HasCaught().should be(false)      
    end
  end
  
  it "raises an erro if you try to access it outside of its scope" do
    tc = C::TryCatch.try do |catch|
      catch.tap {}
    end
    lambda {
      tc.HasCaught()
    }.should raise_error(ScriptError)
  end
  
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
therubyracer-0.8.2 spec/ext/try_catch_spec.rb
therubyracer-0.9.0beta2 spec/ext/try_catch_spec.rb
therubyracer-0.9.0beta1 spec/ext/try_catch_spec.rb
therubyracer-0.8.2.pre2 spec/ext/try_catch_spec.rb
therubyracer-0.8.2.pre spec/ext/try_catch_spec.rb
therubyracer-0.8.1 spec/ext/try_catch_spec.rb
therubyracer-0.8.1.pre2 spec/ext/try_catch_spec.rb
therubyracer-heroku-0.8.1.pre3 spec/ext/try_catch_spec.rb
therubyracer-heroku-0.8.1.pre2 spec/ext/try_catch_spec.rb
therubyracer-0.8.1.pre1 spec/ext/try_catch_spec.rb
therubyracer-0.8.0 spec/ext/try_catch_spec.rb
therubyracer-0.8.0.pre3 spec/ext/try_catch_spec.rb
therubyracer-0.8.0.pre2 spec/ext/try_catch_spec.rb
therubyracer-0.8.0.pre spec/ext/try_catch_spec.rb
therubyracer-0.7.5 spec/ext/try_catch_spec.rb
therubyracer-0.7.4 spec/ext/try_catch_spec.rb
therubyracer-0.7.3 spec/ext/try_catch_spec.rb
therubyracer-0.7.2 spec/ext/try_catch_spec.rb
therubyracer-0.7.2.pre spec/ext/try_catch_spec.rb
therubyracer-0.7.1 spec/ext/try_catch_spec.rb