Browse Source

test: increase coverage for punycode's decode

Added test cases for error.

PR-URL: https://github.com/nodejs/node/pull/10940
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
v6
abouthiroppy 8 years ago
committed by Michaël Zasso
parent
commit
3160b0286d
  1. 9
      test/parallel/test-punycode.js

9
test/parallel/test-punycode.js

@ -24,6 +24,15 @@ assert.strictEqual(
'Willst du die Blüthe des frühen, die Früchte des späteren Jahres' 'Willst du die Blüthe des frühen, die Früchte des späteren Jahres'
); );
assert.strictEqual(punycode.decode('wgv71a119e'), '日本語'); 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 // http://tools.ietf.org/html/rfc3492#section-7.1
const tests = [ const tests = [

Loading…
Cancel
Save