Skip to content

Commit 69a04a9

Browse files
hiroppyitaloacasas
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 95faa55 commit 69a04a9

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
@@ -18,6 +18,15 @@ assert.strictEqual(punycode.decode(
1818
'Willst du die Blthe des frhen, die Frchte des spteren Jahres-x9e96lkal'),
1919
'Willst du die Blüthe des frühen, die Früchte des späteren Jahres');
2020
assert.strictEqual(punycode.decode('wgv71a119e'), '日本語');
21+
assert.throws(() => {
22+
punycode.decode(' ');
23+
}, /^RangeError: Invalid input$/);
24+
assert.throws(() => {
25+
punycode.decode('α-');
26+
}, /^RangeError: Illegal input >= 0x80 \(not a basic code point\)$/);
27+
assert.throws(() => {
28+
punycode.decode('あ');
29+
}, /^RangeError: Overflow: input needs wider integers to process$/);
2130

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

0 commit comments

Comments
 (0)