Skip to content

Commit 587c414

Browse files
authored
Cherry pick some loader string test cases (#2050)
1 parent 8eaa44a commit 587c414

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/loader/tests/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ function test(file) {
5959
assert.strictEqual(exports.strlen(ref), str.length);
6060
}
6161

62+
// should be able to allocate and work with a string containing an isolated high surrogate
63+
{
64+
let str = "𝄞".substring(0, 1);
65+
let ref = exports.__newString(str);
66+
assert.strictEqual(exports.__getString(ref), str);
67+
assert.strictEqual(exports.strlen(ref), str.length);
68+
}
69+
70+
// should be able to allocate and work with a string containing an isolated low surrogate
71+
{
72+
let str = "𝄞".substring(1);
73+
let ref = exports.__newString(str);
74+
assert.strictEqual(exports.__getString(ref), str);
75+
assert.strictEqual(exports.strlen(ref), str.length);
76+
}
77+
6278
// should be able to allocate a typed array
6379
{
6480
let arr = [1, 2, 3, 4, 5, 0x80000000 | 0];

0 commit comments

Comments
 (0)