1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

expose V8 version string.

This commit is contained in:
Charles Lowell 2012-06-14 03:52:32 -05:00
parent e5aef04dfc
commit a20ade811c
3 changed files with 10 additions and 1 deletions

View file

@ -790,6 +790,7 @@ public:
static VALUE IdleNotification(int argc, VALUE argv[], VALUE self);
static VALUE SetCaptureStackTraceForUncaughtExceptions(int argc, VALUE argv[], VALUE self);
static VALUE GetHeapStatistics(VALUE self, VALUE statistics_ptr);
static VALUE GetVersion(VALUE self);
};
class ClassBuilder {

View file

@ -6,7 +6,8 @@ void V8::Init() {
ClassBuilder("V8").
defineSingletonMethod("IdleNotification", &IdleNotification).
defineSingletonMethod("SetCaptureStackTraceForUncaughtExceptions", &SetCaptureStackTraceForUncaughtExceptions).
defineSingletonMethod("GetHeapStatistics", &GetHeapStatistics);
defineSingletonMethod("GetHeapStatistics", &GetHeapStatistics).
defineSingletonMethod("GetVersion", &GetVersion);
}
VALUE V8::IdleNotification(int argc, VALUE argv[], VALUE self) {
@ -30,4 +31,7 @@ VALUE V8::GetHeapStatistics(VALUE self, VALUE statistics_ptr) {
Void(v8::V8::GetHeapStatistics(HeapStatistics(statistics_ptr)));
}
VALUE V8::GetVersion(VALUE self) {
return rb_str_new2(v8::V8::GetVersion());
}
}

View file

@ -13,4 +13,8 @@ describe V8::C do
V8::C::Value::Empty.should_not be_nil
V8::C::Value::Empty.should be V8::C::Value::Empty
end
it "can access the V8 version" do
V8::C::V8::GetVersion().should match /^3\.10/
end
end