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 e21d784

Browse filesBrowse files
Lauri Piisangcodebytere
authored andcommitted
test: add else and error case for TextDecoder
add test for tinyurl.com/codeandlearn-encoding-1 add test for tinyurl.com/codeandlearn-encoding-2 PR-URL: #24162 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 33fd13c commit e21d784
Copy full SHA for e21d784

File tree

Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-0
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-encoding-textdecoder-fatal.js
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,15 @@ bad.forEach((t) => {
9191
assert(!new TextDecoder().fatal);
9292
assert(new TextDecoder('utf-8', { fatal: true }).fatal);
9393
}
94+
95+
{
96+
const notArrayBufferViewExamples = [false, {}, 1, '', new Error()];
97+
notArrayBufferViewExamples.forEach((invalidInputType) => {
98+
common.expectsError(() => {
99+
new TextDecoder(undefined, null).decode(invalidInputType);
100+
}, {
101+
code: 'ERR_INVALID_ARG_TYPE',
102+
type: TypeError
103+
});
104+
});
105+
}
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-encoding-textdecoder.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ if (common.hasIntl) {
7676
});
7777
}
7878

79+
// Test TextDecoder, label undefined, options null
80+
{
81+
const dec = new TextDecoder(undefined, null);
82+
assert.strictEqual(dec.encoding, 'utf-8');
83+
assert.strictEqual(dec.fatal, false);
84+
assert.strictEqual(dec.ignoreBOM, false);
85+
}
86+
7987
// Test TextDecoder, UTF-16le
8088
{
8189
const dec = new TextDecoder('utf-16le');

0 commit comments

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