tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

error-cases.js (901B)


      1 // Copyright 2016 Mozilla Corporation. All rights reserved.
      2 // This code is governed by the license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-intl.getcanonicallocales
      6 description: Tests the getCanonicalLocales function for error tags.
      7 info: |
      8  8.2.1 Intl.getCanonicalLocales (locales)
      9  1. Let ll be ? CanonicalizeLocaleList(locales).
     10  2. Return CreateArrayFromList(ll).
     11 features: [Symbol]
     12 ---*/
     13 
     14 var rangeErrorCases =
     15  [
     16   "en-us-",
     17   "-en-us",
     18   "en-us-en-us",
     19   "--",
     20   "-",
     21   "",
     22   "-e-"
     23  ];
     24 
     25 rangeErrorCases.forEach(function(re) {
     26  assert.throws(RangeError, function() {
     27    Intl.getCanonicalLocales(re);
     28  });
     29 });
     30 
     31 var typeErrorCases =
     32  [
     33    null,
     34    [null],
     35    [undefined],
     36    [true],
     37    [NaN],
     38    [2],
     39    [Symbol('foo')]
     40  ];
     41 
     42 typeErrorCases.forEach(function(te) {
     43  assert.throws(TypeError, function() {
     44    Intl.getCanonicalLocales(te);
     45  });
     46 });
     47 
     48 reportCompare(0, 0);