mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
Add ability to create handle scopes
This commit is contained in:
parent
2fca33f9d0
commit
1f7192ca85
4 changed files with 31 additions and 2 deletions
|
@ -10,9 +10,9 @@ extern "C" {
|
||||||
void Init_init() {
|
void Init_init() {
|
||||||
V8::Init();
|
V8::Init();
|
||||||
Isolate::Init();
|
Isolate::Init();
|
||||||
|
Handles::Init();
|
||||||
// v8::Locker lock();
|
// v8::Locker lock();
|
||||||
// GC::Init();
|
// GC::Init();
|
||||||
// Handles::Init();
|
|
||||||
// Accessor::Init();
|
// Accessor::Init();
|
||||||
// Context::Init();
|
// Context::Init();
|
||||||
// Invocation::Init();
|
// Invocation::Init();
|
||||||
|
|
22
spec/c/handles_spec.rb
Normal file
22
spec/c/handles_spec.rb
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
require 'v8/init'
|
||||||
|
|
||||||
|
describe 'handles' do
|
||||||
|
describe '#HandleScope' do
|
||||||
|
let(:isolate) { V8::C::Isolate.New }
|
||||||
|
|
||||||
|
it 'can allocate handle scopes' do
|
||||||
|
V8::C::HandleScope(isolate) do
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'isn\'t the end of the world if a ruby exception is raised inside a HandleScope' do
|
||||||
|
begin
|
||||||
|
V8::C::HandleScope(isolate) do
|
||||||
|
raise 'boom!'
|
||||||
|
end
|
||||||
|
rescue StandardError => e
|
||||||
|
expect(e.message).to eq 'boom!'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
require 'v8/init'
|
require 'v8/init'
|
||||||
|
|
||||||
describe V8::C::Isolate do
|
describe V8::C::Isolate do
|
||||||
it "can create a new isolate" do
|
it 'can create a new isolate' do
|
||||||
expect(V8::C::Isolate.New).to be
|
expect(V8::C::Isolate.New).to be
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
7
spec/c/v8_spec.rb
Normal file
7
spec/c/v8_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require 'v8/init'
|
||||||
|
|
||||||
|
describe V8::C::V8 do
|
||||||
|
it 'can say its version' do
|
||||||
|
expect(V8::C::V8.GetVersion).to be_a String
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue