tor-browser

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

missing-unicode-ext-value-defaults-to-true.js (1275B)


      1 // Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
      2 // Copyright 2012 Mozilla Corporation. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 es5id: 9.2.5_11_g_ii_2
      7 description: >
      8    Tests that missing Unicode extension values default to true for
      9    boolean keys.
     10 author: Norbert Lindenberg
     11 ---*/
     12 
     13 var extensions = ["-u-co-phonebk-kn", "-u-kn-co-phonebk", "-u-co-phonebk-kn-true", "-u-kn-true-co-phonebk"];
     14 extensions.forEach(function (extension) {
     15    var defaultLocale = new Intl.Collator().resolvedOptions().locale;
     16    var collator = new Intl.Collator([defaultLocale + extension], {usage: "sort"});
     17    var locale = collator.resolvedOptions().locale;
     18    var numeric = collator.resolvedOptions().numeric;
     19    if (numeric !== undefined) {
     20        assert.sameValue(numeric, true, "Default value for \"kn\" should be true, but is " + numeric + ".");
     21        assert.sameValue(locale.indexOf("-kn-false"), -1, "\"kn-false\" is returned in locale, but shouldn't be.");
     22        assert.sameValue(locale.indexOf("-kn-true"), -1, "\"kn-true\" is returned in locale, but shouldn't be.");
     23        assert.sameValue(locale.indexOf("-kn") >= 0, true, "\"kn\" should be returned in locale.");
     24    }
     25 });
     26 
     27 reportCompare(0, 0);