File: test-x-user-defined.js

package info (click to toggle)
node-text-encoding 0.6.4-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 1,652 kB
  • sloc: makefile: 2; sh: 2
file content (15 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// This is free and unencumbered software released into the public domain.
// See LICENSE.md for more information.

test(
  function() {
    assert_equals(new TextEncoder('x-user-defined').encoding, 'utf-8');

    var decoder = new TextDecoder('x-user-defined');
    for (var i = 0; i < 0x80; ++i) {
      assert_equals(decoder.decode(new Uint8Array([i])), String.fromCharCode(i));
      assert_equals(decoder.decode(new Uint8Array([i + 0x80])), String.fromCharCode(i + 0xF780));
    }
  },
  "x-user-defined encoding"
);