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
  • Loading branch information
targos committed Jun 14, 2023
1 parent 23941ae commit 6209a78
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 @@ -36,13 +36,23 @@ const fn4 = path.join(tmpdir.path, '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 @@ -52,7 +62,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 @@ -62,7 +73,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 @@ -72,7 +84,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 6209a78

Please sign in to comment.