Skip to content

Commit 3160b02

Browse files
hiroppytargos
authored andcommitted
test: increase coverage for punycode's decode
Added test cases for error. PR-URL: #10940 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent ed0086f commit 3160b02

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/parallel/test-punycode.js

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ assert.strictEqual(
2424
'Willst du die Blüthe des frühen, die Früchte des späteren Jahres'
2525
);
2626
assert.strictEqual(punycode.decode('wgv71a119e'), '日本語');
27+
assert.throws(() => {
28+
punycode.decode(' ');
29+
}, /^RangeError: Invalid input$/);
30+
assert.throws(() => {
31+
punycode.decode('α-');
32+
}, /^RangeError: Illegal input >= 0x80 \(not a basic code point\)$/);
33+
assert.throws(() => {
34+
punycode.decode('あ');
35+
}, /^RangeError: Overflow: input needs wider integers to process$/);
2736

2837
// http://tools.ietf.org/html/rfc3492#section-7.1
2938
const tests = [

0 commit comments

Comments
 (0)