Skip to content

Commit

Permalink
test: improve test coverage for WHATWG TextDecoder
Browse files Browse the repository at this point in the history
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: #45241
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
juanarbol committed Jan 31, 2023
1 parent 6317502 commit 1790569
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/parallel/test-whatwg-encoding-custom-textdecoder.js
Expand Up @@ -51,6 +51,19 @@ assert(TextDecoder);
});
}

// Invalid encoders
{
['meow', 'nonunicode', 'foo', 'bar'].forEach((fakeEncoding) => {
assert.throws(
() => { new TextDecoder(fakeEncoding); },
{
code: 'ERR_ENCODING_NOT_SUPPORTED',
name: 'RangeError'
}
);
});
}

// Test TextDecoder, UTF-8, fatal: true, ignoreBOM: false
if (common.hasIntl) {
['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => {
Expand Down

0 comments on commit 1790569

Please sign in to comment.