Skip to content

Commit

Permalink
test: adapt test-fs-write to V8 internal changes
Browse files Browse the repository at this point in the history
PR-URL: #49639
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
targos committed Oct 10, 2023
1 parent 8c36168 commit de5c009
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions test/parallel/test-fs-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,23 @@ const fn4 = tmpdir.resolve('write4.txt');
const expected = 'ümlaut.';
const constants = fs.constants;

const { externalizeString, isOneByteString } = global;
const {
createExternalizableString,
externalizeString,
isOneByteString,
} = global;

// Account for extra globals exposed by --expose_externalize_string.
common.allowGlobals(externalizeString, isOneByteString, global.x);
common.allowGlobals(
createExternalizableString,
externalizeString,
isOneByteString,
global.x,
);

{
const expected = 'ümlaut sechzig'; // Must be a unique string.
// Must be a unique string.
const expected = createExternalizableString('ümlaut sechzig');
externalizeString(expected);
assert.strictEqual(isOneByteString(expected), true);
const fd = fs.openSync(fn, 'w');
Expand All @@ -51,7 +61,8 @@ common.allowGlobals(externalizeString, isOneByteString, global.x);
}

{
const expected = 'ümlaut neunzig'; // Must be a unique string.
// Must be a unique string.
const expected = createExternalizableString('ümlaut neunzig');
externalizeString(expected);
assert.strictEqual(isOneByteString(expected), true);
const fd = fs.openSync(fn, 'w');
Expand All @@ -61,7 +72,8 @@ common.allowGlobals(externalizeString, isOneByteString, global.x);
}

{
const expected = 'Zhōngwén 1'; // Must be a unique string.
// Must be a unique string.
const expected = createExternalizableString('Zhōngwén 1');
externalizeString(expected);
assert.strictEqual(isOneByteString(expected), false);
const fd = fs.openSync(fn, 'w');
Expand All @@ -71,7 +83,8 @@ common.allowGlobals(externalizeString, isOneByteString, global.x);
}

{
const expected = 'Zhōngwén 2'; // Must be a unique string.
// Must be a unique string.
const expected = createExternalizableString('Zhōngwén 2');
externalizeString(expected);
assert.strictEqual(isOneByteString(expected), false);
const fd = fs.openSync(fn, 'w');
Expand Down

0 comments on commit de5c009

Please sign in to comment.