]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/node-gyp/node_modules/path-array/node_modules/array-index/node_modules/es6-symbol/node_modules/es5-ext/test/string/#/code-point-at/shim.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / node-gyp / node_modules / path-array / node_modules / array-index / node_modules / es6-symbol / node_modules / es5-ext / test / string / # / code-point-at / shim.js
1 // Taken from: https://github.com/mathiasbynens/String.prototype.codePointAt
2 //             /blob/master/tests/tests.js
3
4 'use strict';
5
6 module.exports = function (t, a) {
7         a(t.length, 1, "Length");
8
9         // String that starts with a BMP symbol
10         a(t.call('abc\uD834\uDF06def', ''), 0x61);
11         a(t.call('abc\uD834\uDF06def', '_'), 0x61);
12         a(t.call('abc\uD834\uDF06def'), 0x61);
13         a(t.call('abc\uD834\uDF06def', -Infinity), undefined);
14         a(t.call('abc\uD834\uDF06def', -1), undefined);
15         a(t.call('abc\uD834\uDF06def', -0), 0x61);
16         a(t.call('abc\uD834\uDF06def', 0), 0x61);
17         a(t.call('abc\uD834\uDF06def', 3), 0x1D306);
18         a(t.call('abc\uD834\uDF06def', 4), 0xDF06);
19         a(t.call('abc\uD834\uDF06def', 5), 0x64);
20         a(t.call('abc\uD834\uDF06def', 42), undefined);
21         a(t.call('abc\uD834\uDF06def', Infinity), undefined);
22         a(t.call('abc\uD834\uDF06def', Infinity), undefined);
23         a(t.call('abc\uD834\uDF06def', NaN), 0x61);
24         a(t.call('abc\uD834\uDF06def', false), 0x61);
25         a(t.call('abc\uD834\uDF06def', null), 0x61);
26         a(t.call('abc\uD834\uDF06def', undefined), 0x61);
27
28         // String that starts with an astral symbol
29         a(t.call('\uD834\uDF06def', ''), 0x1D306);
30         a(t.call('\uD834\uDF06def', '1'), 0xDF06);
31         a(t.call('\uD834\uDF06def', '_'), 0x1D306);
32         a(t.call('\uD834\uDF06def'), 0x1D306);
33         a(t.call('\uD834\uDF06def', -1), undefined);
34         a(t.call('\uD834\uDF06def', -0), 0x1D306);
35         a(t.call('\uD834\uDF06def', 0), 0x1D306);
36         a(t.call('\uD834\uDF06def', 1), 0xDF06);
37         a(t.call('\uD834\uDF06def', 42), undefined);
38         a(t.call('\uD834\uDF06def', false), 0x1D306);
39         a(t.call('\uD834\uDF06def', null), 0x1D306);
40         a(t.call('\uD834\uDF06def', undefined), 0x1D306);
41
42         // Lone high surrogates
43         a(t.call('\uD834abc', ''), 0xD834);
44         a(t.call('\uD834abc', '_'), 0xD834);
45         a(t.call('\uD834abc'), 0xD834);
46         a(t.call('\uD834abc', -1), undefined);
47         a(t.call('\uD834abc', -0), 0xD834);
48         a(t.call('\uD834abc', 0), 0xD834);
49         a(t.call('\uD834abc', false), 0xD834);
50         a(t.call('\uD834abc', NaN), 0xD834);
51         a(t.call('\uD834abc', null), 0xD834);
52         a(t.call('\uD834abc', undefined), 0xD834);
53
54         // Lone low surrogates
55         a(t.call('\uDF06abc', ''), 0xDF06);
56         a(t.call('\uDF06abc', '_'), 0xDF06);
57         a(t.call('\uDF06abc'), 0xDF06);
58         a(t.call('\uDF06abc', -1), undefined);
59         a(t.call('\uDF06abc', -0), 0xDF06);
60         a(t.call('\uDF06abc', 0), 0xDF06);
61         a(t.call('\uDF06abc', false), 0xDF06);
62         a(t.call('\uDF06abc', NaN), 0xDF06);
63         a(t.call('\uDF06abc', null), 0xDF06);
64         a(t.call('\uDF06abc', undefined), 0xDF06);
65
66         a.throws(function () { t.call(undefined); }, TypeError);
67         a.throws(function () { t.call(undefined, 4); }, TypeError);
68         a.throws(function () { t.call(null); }, TypeError);
69         a.throws(function () { t.call(null, 4); }, TypeError);
70         a(t.call(42, 0), 0x34);
71         a(t.call(42, 1), 0x32);
72         a(t.call({ toString: function () { return 'abc'; } }, 2), 0x63);
73
74         a.throws(function () { t.apply(undefined); }, TypeError);
75         a.throws(function () { t.apply(undefined, [4]); }, TypeError);
76         a.throws(function () { t.apply(null); }, TypeError);
77         a.throws(function () { t.apply(null, [4]); }, TypeError);
78         a(t.apply(42, [0]), 0x34);
79         a(t.apply(42, [1]), 0x32);
80         a(t.apply({ toString: function () { return 'abc'; } }, [2]), 0x63);
81 };