tor-browser

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

islamic-tbla-invalid-month-code-m13.js (1233B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2025 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.plainmonthday.from
      7 description: M13 month code is invalid for Islamic-tbla calendar (12-month calendar)
      8 features: [Temporal, Intl.Era-monthcode]
      9 ---*/
     10 
     11 // The Islamic-tbla calendar is a 12-month calendar and should not accept M13
     12 
     13 const calendar = "islamic-tbla";
     14 
     15 assert.throws(RangeError, () => {
     16  Temporal.PlainMonthDay.from({ calendar, monthCode: "M13", day: 1 });
     17 }, `M13 should not be a valid month code for ${calendar} calendar`);
     18 
     19 // M13 should throw even with overflow: "constrain"
     20 assert.throws(RangeError, () => {
     21  Temporal.PlainMonthDay.from({ calendar, monthCode: "M13", day: 1 }, { overflow: "constrain" });
     22 }, `M13 should not be valid for ${calendar} calendar even with constrain overflow`);
     23 
     24 // M13 should throw with overflow: "reject"
     25 assert.throws(RangeError, () => {
     26  Temporal.PlainMonthDay.from({ calendar, monthCode: "M13", day: 1 }, { overflow: "reject" });
     27 }, `M13 should not be valid for ${calendar} calendar with reject overflow`);
     28 
     29 reportCompare(0, 0);