tor-browser

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

year-zero.js (937B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 description: Negative zero, as an extended year, fails
      7 esid: sec-temporal.plainyearmonth.compare
      8 features: [Temporal]
      9 ---*/
     10 
     11 const ok = new Temporal.PlainYearMonth(2000, 5);
     12 const invalidStrings = [
     13  "-000000-06",
     14  "-000000-06-24",
     15  "-000000-06-24T15:43:27",
     16  "-000000-06-24T15:43:27+01:00",
     17  "-000000-06-24T15:43:27+00:00[UTC]",
     18 ];
     19 
     20 invalidStrings.forEach((arg) => {
     21  assert.throws(
     22    RangeError,
     23    () => Temporal.PlainYearMonth.compare(arg, ok),
     24    "Cannot use minus zero as extended year (first argument)"
     25  );
     26 
     27  assert.throws(
     28    RangeError,
     29    () => Temporal.PlainYearMonth.compare(ok, arg),
     30    "Cannot use minus zero as extended year (second argument)"
     31  );
     32 });
     33 
     34 reportCompare(0, 0);