js/src/tests/ecma_6/String/fromCodePoint.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 var BUGNUMBER = 918879;
     2 var summary = 'String.fromCodePoint';
     4 print(BUGNUMBER + ": " + summary);
     6 // Tests taken from:
     7 // https://github.com/mathiasbynens/String.fromCodePoint/blob/master/tests/tests.js
     9 assertEq(String.fromCodePoint.length, 0);
    10 assertEq(String.propertyIsEnumerable('fromCodePoint'), false);
    12 assertEq(String.fromCodePoint(''), '\0');
    13 assertEq(String.fromCodePoint(), '');
    14 assertEq(String.fromCodePoint(-0), '\0');
    15 assertEq(String.fromCodePoint(0), '\0');
    16 assertEq(String.fromCodePoint(0x1D306), '\uD834\uDF06');
    17 assertEq(String.fromCodePoint(0x1D306, 0x61, 0x1D307), '\uD834\uDF06a\uD834\uDF07');
    18 assertEq(String.fromCodePoint(0x61, 0x62, 0x1D307), 'ab\uD834\uDF07');
    19 assertEq(String.fromCodePoint(false), '\0');
    20 assertEq(String.fromCodePoint(null), '\0');
    22 assertThrowsInstanceOf(function() { String.fromCodePoint('_'); }, RangeError);
    23 assertThrowsInstanceOf(function() { String.fromCodePoint('+Infinity'); }, RangeError);
    24 assertThrowsInstanceOf(function() { String.fromCodePoint('-Infinity'); }, RangeError);
    25 assertThrowsInstanceOf(function() { String.fromCodePoint(-1); }, RangeError);
    26 assertThrowsInstanceOf(function() { String.fromCodePoint(0x10FFFF + 1); }, RangeError);
    27 assertThrowsInstanceOf(function() { String.fromCodePoint(3.14); }, RangeError);
    28 assertThrowsInstanceOf(function() { String.fromCodePoint(3e-2); }, RangeError);
    29 assertThrowsInstanceOf(function() { String.fromCodePoint(Infinity); }, RangeError);
    30 assertThrowsInstanceOf(function() { String.fromCodePoint(NaN); }, RangeError);
    31 assertThrowsInstanceOf(function() { String.fromCodePoint(undefined); }, RangeError);
    32 assertThrowsInstanceOf(function() { String.fromCodePoint({}); }, RangeError);
    34 var counter = Math.pow(2, 15) * 3 / 2;
    35 var result = [];
    36 while (--counter >= 0) {
    37         result.push(0); // one code unit per symbol
    38 }
    39 String.fromCodePoint.apply(null, result); // must not throw
    41 var counter = Math.pow(2, 15) * 3 / 2;
    42 var result = [];
    43 while (--counter >= 0) {
    44         result.push(0xFFFF + 1); // two code units per symbol
    45 }
    46 String.fromCodePoint.apply(null, result); // must not throw
    48 reportCompare(0, 0, "ok");

mercurial