tor-browser

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

argument-string-calendar-annotation-invalid-key.js (1064B)


      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.from
      7 description: Annotation keys are lowercase-only 
      8 features: [Temporal]
      9 ---*/
     10 
     11 const invalidStrings = [
     12  ["1970-01-01T00:00[UTC][U-CA=iso8601]", "invalid capitalized key"],
     13  ["1970-01-01T00:00[UTC][u-CA=iso8601]", "invalid partially-capitalized key"],
     14  ["1970-01-01T00:00[UTC][FOO=bar]", "invalid capitalized unrecognized key"],
     15 ];
     16 
     17 invalidStrings.forEach(([arg, descr]) => {
     18  assert.throws(
     19    RangeError,
     20    () => Temporal.ZonedDateTime.from(arg),
     21    `annotation keys must be lowercase: ${arg} - ${descr}`
     22  );
     23  for (const offset of ["use", "prefer", "ignore", "reject"]) {
     24    assert.throws(
     25      RangeError,
     26      () => Temporal.ZonedDateTime.from(arg, { offset }),
     27      `annotation keys must be lowercase: ${arg} - ${descr} (offset ${offset})`
     28    );
     29  }
     30 });
     31 
     32 reportCompare(0, 0);