Skip to content

Commit

Permalink
test: increase coverage for punycode's decode
Browse files Browse the repository at this point in the history
Added test cases for error.

PR-URL: nodejs#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]>
  • Loading branch information
hiroppy authored and italoacasas committed Jan 27, 2017
1 parent df85d7c commit bddfef3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/parallel/test-punycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ assert.strictEqual(punycode.decode(
'Willst du die Blthe des frhen, die Frchte des spteren Jahres-x9e96lkal'),
'Willst du die Blüthe des frühen, die Früchte des späteren Jahres');
assert.strictEqual(punycode.decode('wgv71a119e'), '日本語');
assert.throws(() => {
punycode.decode(' ');
}, /^RangeError: Invalid input$/);
assert.throws(() => {
punycode.decode('α-');
}, /^RangeError: Illegal input >= 0x80 \(not a basic code point\)$/);
assert.throws(() => {
punycode.decode('あ');
}, /^RangeError: Overflow: input needs wider integers to process$/);

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

0 comments on commit bddfef3

Please sign in to comment.