tor-browser

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

observable-get-overflow-argument-primitive.js (1574B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2023 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.from
      7 description: options properties are extracted with string argument.
      8 includes: [compareArray.js, temporalHelpers.js]
      9 features: [Temporal]
     10 ---*/
     11 
     12 const expected = [
     13  "get options.disambiguation",
     14  "get options.disambiguation.toString",
     15  "call options.disambiguation.toString",
     16  "get options.offset",
     17  "get options.offset.toString",
     18  "call options.offset.toString",
     19  "get options.overflow",
     20  "get options.overflow.toString",
     21  "call options.overflow.toString",
     22 ];
     23 
     24 let actual = [];
     25 const options = TemporalHelpers.propertyBagObserver(actual, {
     26  disambiguation: "compatible",
     27  offset: "ignore",
     28  overflow: "reject",
     29 }, "options");
     30 
     31 const result = Temporal.ZonedDateTime.from("2001-09-09T01:46:40+00:00[UTC]", options);
     32 assert.compareArray(actual, expected, "Successful call");
     33 assert.sameValue(result.epochNanoseconds, 1_000_000_000_000_000_000n);
     34 
     35 actual.splice(0);  // empty it for the next check
     36 
     37 assert.throws(TypeError, () => Temporal.ZonedDateTime.from(7, options));
     38 assert.compareArray(actual, [], "Failing call before options is processed");
     39 
     40 actual.splice(0);
     41 
     42 assert.throws(RangeError, () => Temporal.ZonedDateTime.from({ year: 2021, month: 2, day: 29, timeZone: "UTC" }, options));
     43 assert.compareArray(actual, expected, "Failing call after options is processed");
     44 
     45 reportCompare(0, 0);