mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
38 lines
No EOL
857 B
Ruby
38 lines
No EOL
857 B
Ruby
require 'spec_helper'
|
|
|
|
describe V8::C::Locker do
|
|
include ExplicitScoper
|
|
|
|
it "can lock and unlock the VM" do
|
|
V8::C::Locker::IsLocked().should be_false
|
|
V8::C::Locker() do
|
|
V8::C::Locker::IsLocked().should be_true
|
|
V8::C::Unlocker() do
|
|
V8::C::Locker::IsLocked().should be_false
|
|
end
|
|
end
|
|
V8::C::Locker::IsLocked().should be_false
|
|
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_false
|
|
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_true
|
|
end
|
|
end
|
|
end
|
|
end |