tor-browser

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

constructor-trailingZeroDisplay-invalid.js (1069B)


      1 // Copyright 2021 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-initializenumberformat
      5 description: Rejects invalid values for trailingZeroDisplay option.
      6 features: [Intl.NumberFormat-v3]
      7 ---*/
      8 
      9 assert.throws(RangeError, function() {
     10  new Intl.NumberFormat([], {trailingZeroDisplay: ''});
     11 }, 'empty string');
     12 
     13 assert.throws(RangeError, function() {
     14  new Intl.NumberFormat([], {trailingZeroDisplay: 'Auto'});
     15 }, 'Auto');
     16 
     17 assert.throws(RangeError, function() {
     18  new Intl.NumberFormat([], {trailingZeroDisplay: 'StripIfInteger'});
     19 }, 'StripIfInteger');
     20 
     21 assert.throws(RangeError, function() {
     22  new Intl.NumberFormat([], {trailingZeroDisplay: 'stripifinteger'});
     23 }, 'stripifinteger');
     24 
     25 assert.throws(RangeError, function() {
     26  new Intl.NumberFormat([], {trailingZeroDisplay: ' auto'});
     27 }, '" auto" (with leading space)');
     28 
     29 assert.throws(RangeError, function() {
     30  new Intl.NumberFormat([], {trailingZeroDisplay: 'auto '});
     31 }, '"auto " (with trailing space)');
     32 
     33 reportCompare(0, 0);