tor-browser

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

year-zero.js (862B)


      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 esid: sec-temporal.instant.compare
      7 description: Negative zero, as an extended year, fails
      8 features: [Temporal]
      9 ---*/
     10 
     11 const instance = new Temporal.Instant(0n);
     12 const invalidStrings = [
     13  "-000000-03-30T00:45Z",
     14  "-000000-03-30T01:45+01:00",
     15  "-000000-03-30T01:45:00+00:00[UTC]",
     16 ];
     17 
     18 invalidStrings.forEach((arg) => {
     19  assert.throws(RangeError,
     20    () => Temporal.Instant.compare(arg, instance),
     21    "minus zero is invalid extended year (first argument)");
     22  assert.throws(RangeError,
     23    () => Temporal.Instant.compare(instance, arg),
     24    "minus zero is invalid extended year (second argument)"
     25  );
     26 });
     27 
     28 reportCompare(0, 0);