Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tests: Add regression tests for punycode

  • Loading branch information...
commit a86ab2c08d4665dbc7ab3287b0bead18e2b9510f 1 parent 4d8a0ca
@mathiasbynens authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 test/simple/test-punycode.js
View
13 test/simple/test-punycode.js
@@ -179,4 +179,17 @@ for (var encoded in tests) {
}
}
+// BMP code point
+assert.equal(punycode.ucs2.encode([0x61]), 'a');
+// supplementary code point (surrogate pair)
+assert.equal(punycode.ucs2.encode([0x1D306]), '\uD834\uDF06');
+// high surrogate
+assert.equal(punycode.ucs2.encode([0xD800]), '\uD800');
+// high surrogate followed by non-surrogates
+assert.equal(punycode.ucs2.encode([0xD800, 0x61, 0x62]), '\uD800ab');
+// low surrogate
+assert.equal(punycode.ucs2.encode([0xDC00]), '\uDC00');
+// low surrogate followed by non-surrogates
+assert.equal(punycode.ucs2.encode([0xDC00, 0x61, 0x62]), '\uDC00ab');
+
assert.equal(errors, 0);
Please sign in to comment.
Something went wrong with that request. Please try again.