tor-browser

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

argument-string-minus-sign.js (969B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2024 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.zoneddatetime.compare
      7 description: Non-ASCII minus sign is not acceptable
      8 features: [Temporal]
      9 ---*/
     10 
     11 const invalidStrings = [
     12  "1976-11-18T15:23:30.12\u221202:00",
     13  "1976-11-18T15:23:30.12-02:00[\u221202:00]",
     14  "1976-11-18T15:23:30.12\u221202:00[\u221202:00]",
     15  "\u2212009999-11-18T15:23:30.12[UTC]",
     16 ];
     17 
     18 const datetime = new Temporal.ZonedDateTime(0n, "UTC");
     19 invalidStrings.forEach((arg) => {
     20  assert.throws(
     21    RangeError,
     22    () => Temporal.ZonedDateTime.compare(arg, datetime),
     23    `variant minus sign: ${arg} (first argument)`
     24  );
     25 
     26  assert.throws(
     27    RangeError,
     28    () => Temporal.ZonedDateTime.compare(datetime, arg),
     29    `variant minus sign: ${arg} (second argument)`
     30  );
     31 });
     32 
     33 reportCompare(0, 0);