Sha256: 241f734b84b0c5f4b8521baecdad9fc2ed771d000f6a7f6256523cbdc85617e2

Contents?: true

Size: 840 Bytes

Versions: 3

Compression:

Stored size: 840 Bytes

Contents

require 'spec_helper'

describe V8::C::Locker do
  it "can lock and unlock the VM" do
    V8::C::Locker::IsLocked().should be_falsey
    V8::C::Locker() do
      V8::C::Locker::IsLocked().should be_truthy
      V8::C::Unlocker() do
        V8::C::Locker::IsLocked().should be_falsey
      end
    end
    V8::C::Locker::IsLocked().should be_falsey
  end

  it "properly unlocks if an exception is thrown inside a lock block" do
    begin
      V8::C::Locker() do
        raise "boom!"
      end
    rescue
      V8::C::Locker::IsLocked().should be_falsey
    end
  end

  it "properly re-locks if an exception is thrown inside an un-lock block" do
    V8::C::Locker() do
      begin
        V8::C::Unlocker() do
          raise "boom!"
        end
      rescue
        V8::C::Locker::IsLocked().should be_truthy
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
therubyracer-0.12.3 spec/c/locker_spec.rb
therubyracer-xcode-0.12.3 spec/c/locker_spec.rb
therubyracer-xcode-0.12.2 spec/c/locker_spec.rb