tor-browser

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

argument-string-fractional-with-zero-subparts.js (875B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2022 André Bargull. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-temporal.duration.from
      7 description: >
      8  Throws when a fractional unit is present and a sub-part is zero.
      9 features: [Temporal]
     10 ---*/
     11 
     12 const invalid = [
     13  // Hours fraction with whole minutes.
     14  "PT0.1H0M",
     15 
     16  // Hours fraction with fractional minutes.
     17  "PT0.1H0.0M",
     18 
     19  // Hours fraction with whole seconds.
     20  "PT0.1H0S",
     21 
     22  // Hours fraction with fractional seconds.
     23  "PT0.1H0.0S",
     24 
     25  // Minutes fraction with whole seconds.
     26  "PT0.1M0S",
     27 
     28  // Minutes fraction with fractional seconds.
     29  "PT0.1M0.0S",
     30 ];
     31 
     32 for (let string of invalid) {
     33  assert.throws(RangeError, () => Temporal.Duration.from(string));
     34 }
     35 
     36 reportCompare(0, 0);