File tree Expand file tree Collapse file tree 3 files changed +12
-1
lines changed
Expand file tree Collapse file tree 3 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ Nan::MaybeLocal<v8::String> Nan::New<T>(std::string const& value);
6464Nan::MaybeLocal<v8::String> Nan::New<T>(const char * value, int length);
6565Nan::MaybeLocal<v8::String> Nan::New<T>(const char * value);
6666Nan::MaybeLocal<v8::String> Nan::New<T>(const uint16_t * value);
67+ Nan::MaybeLocal<v8::String> Nan::New<T>(const uint16_t * value, int length);
6768```
6869
6970Specialized types:
Original file line number Diff line number Diff line change @@ -299,6 +299,12 @@ New(const char * value, int length) {
299299 return New<v8::String>(value, length);
300300}
301301
302+ inline
303+ imp::Factory<v8::String>::return_t
304+ New (const uint16_t * value, int length) {
305+ return New<v8::String>(value, length);
306+ }
307+
302308inline
303309imp::Factory<v8::String>::return_t
304310New (const char * value) {
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ NAN_METHOD(testSignature) {
289289NAN_METHOD (testString) {
290290 Tap t (info[0 ]);
291291
292- t.plan (14 );
292+ t.plan (16 );
293293
294294 t.ok (_ ( stringMatches (
295295 New<String>(" Hello World" ).ToLocalChecked (), " Hello World" )));
@@ -319,6 +319,10 @@ NAN_METHOD(testString) {
319319 t.ok (_ ( stringMatches ( New (" Hello World" , 4 ).ToLocalChecked (), " Hell" )));
320320 t.ok (_ ( assertType<String>( New (" plonk." , 4 ).ToLocalChecked ())));
321321
322+ const uint16_t *widestring = reinterpret_cast <const uint16_t *>(" H\0 e\0 l\0 l\0 o\0 " );
323+ t.ok (_ ( stringMatches ( New (widestring, 4 ).ToLocalChecked (), " Hell" )));
324+ t.ok (_ ( assertType<String>( New (widestring, 4 ).ToLocalChecked ())));
325+
322326 t.ok (_ ( stringMatches ( New (std::string (" bar" )).ToLocalChecked (), " bar" )));
323327 t.ok (_ ( assertType<String>( New (std::string (" plonk." )).ToLocalChecked ())));
324328
You can’t perform that action at this time.
0 commit comments