Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 42e9d80

Browse filesBrowse files
committed
test: fix textdecoder test for small-icu builds
The `Shift_JIS` encoding may not be available, e.g. when Node.js is configured with `--with-intl=small-icu`. PR-URL: #45225 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
1 parent 38202d3 commit 42e9d80
Copy full SHA for 42e9d80

File tree

Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-4
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-whatwg-encoding-custom-textdecoder.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-encoding-custom-textdecoder.js
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,13 @@ if (common.hasIntl) {
201201
}
202202

203203
if (common.hasIntl) {
204-
const decoder = new TextDecoder('Shift_JIS');
205-
const chunk = new Uint8Array([-1]);
206-
const str = decoder.decode(chunk);
207-
assert.strictEqual(str, '\ufffd');
204+
try {
205+
const decoder = new TextDecoder('Shift_JIS');
206+
const chunk = new Uint8Array([-1]);
207+
const str = decoder.decode(chunk);
208+
assert.strictEqual(str, '\ufffd');
209+
} catch (e) {
210+
// Encoding may not be available, e.g. small-icu builds
211+
assert.strictEqual(e.code, 'ERR_ENCODING_NOT_SUPPORTED');
212+
}
208213
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.