2012-06-06 04:08:41 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe V8::C::String do
|
2015-03-15 18:27:19 +00:00
|
|
|
requires_v8_context
|
|
|
|
|
2012-06-06 04:08:41 -05:00
|
|
|
it "can hold Unicode values outside the Basic Multilingual Plane" do
|
|
|
|
string = V8::C::String::New("\u{100000}")
|
|
|
|
string.Utf8Value().should eql "\u{100000}"
|
|
|
|
end
|
2012-06-14 22:34:38 -05:00
|
|
|
|
|
|
|
it "can naturally translate ruby strings into v8 strings" do
|
|
|
|
V8::C::String::Concat(V8::C::String::New("Hello "), "World").Utf8Value().should eql "Hello World"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "can naturally translate ruby objects into v8 strings" do
|
|
|
|
V8::C::String::Concat(V8::C::String::New("forty two is "), 42).Utf8Value().should eql "forty two is 42"
|
|
|
|
end
|
2015-03-15 18:27:19 +00:00
|
|
|
end
|