Skip to content

Cherry pick some loader string test cases #2050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/loader/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ function test(file) {
assert.strictEqual(exports.strlen(ref), str.length);
}

// should be able to allocate and work with a string containing an isolated high surrogate
{
let str = "𝄞".substring(0, 1);
let ref = exports.__newString(str);
assert.strictEqual(exports.__getString(ref), str);
assert.strictEqual(exports.strlen(ref), str.length);
}

// should be able to allocate and work with a string containing an isolated low surrogate
{
let str = "𝄞".substring(1);
let ref = exports.__newString(str);
assert.strictEqual(exports.__getString(ref), str);
assert.strictEqual(exports.strlen(ref), str.length);
}

// should be able to allocate a typed array
{
let arr = [1, 2, 3, 4, 5, 0x80000000 | 0];
Expand Down