tor-browser

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

with-year-monthCode-day-need-constrain.js (3211B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2021 the V8 project authors. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 esid: sec-temporal.plaindate.from
      6 description: With year, monthCode and day and need constrain
      7 info: |
      8  1. Let calendar be the this value.
      9  2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
     10  3. Assert: calendar.[[Identifier]] is "iso8601".
     11  4. If Type(fields) is not Object, throw a TypeError exception.
     12  5. Set options to ? GetOptionsObject(options).
     13  6. Let result be ? ISODateFromFields(fields, options).
     14  7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], result.[[Day]], calendar).
     15 features: [Temporal]
     16 includes: [temporalHelpers.js]
     17 ---*/
     18 
     19 TemporalHelpers.assertPlainDate(
     20    Temporal.PlainDate.from({year: 2021, monthCode: "M01", day: 133}),
     21    2021, 1, "M01", 31,
     22    "year/monthCode/day with day need to be constrained in Jan");
     23 
     24 TemporalHelpers.assertPlainDate(
     25    Temporal.PlainDate.from({year: 2021, monthCode: "M02", day: 133}),
     26    2021, 2, "M02", 28,
     27    "year/monthCode/day with day need to be constrained in Feb");
     28 
     29 TemporalHelpers.assertPlainDate(
     30    Temporal.PlainDate.from({year: 2021, monthCode: "M03", day: 133}),
     31    2021, 3, "M03", 31,
     32    "year/monthCode/day with day need to be constrained in March");
     33 
     34 TemporalHelpers.assertPlainDate(
     35    Temporal.PlainDate.from({year: 2021, monthCode: "M04", day: 133}),
     36    2021, 4, "M04", 30,
     37    "year/monthCode/day with day need to be constrained in April");
     38 
     39 TemporalHelpers.assertPlainDate(
     40    Temporal.PlainDate.from({year: 2021, monthCode: "M05", day: 133}),
     41    2021, 5, "M05", 31,
     42    "year/monthCode/day with day need to be constrained in May");
     43 
     44 TemporalHelpers.assertPlainDate(
     45    Temporal.PlainDate.from({year: 2021, monthCode: "M06", day: 133}),
     46    2021, 6, "M06", 30,
     47    "year/monthCode/day with day need to be constrained in Jun");
     48 
     49 TemporalHelpers.assertPlainDate(
     50    Temporal.PlainDate.from({year: 2021, monthCode: "M07", day: 133}),
     51    2021, 7, "M07", 31,
     52    "year/monthCode/day with day need to be constrained in July");
     53 
     54 TemporalHelpers.assertPlainDate(
     55    Temporal.PlainDate.from({year: 2021, monthCode: "M08", day: 133}),
     56    2021, 8, "M08", 31,
     57    "year/monthCode/day with day need to be constrained in Aug");
     58 
     59 TemporalHelpers.assertPlainDate(
     60    Temporal.PlainDate.from({year: 2021, monthCode: "M09", day: 133}),
     61    2021, 9, "M09", 30,
     62    "year/monthCode/day with day need to be constrained in Sept.");
     63 
     64 TemporalHelpers.assertPlainDate(
     65    Temporal.PlainDate.from({year: 2021, monthCode: "M10", day: 133}),
     66    2021, 10, "M10", 31,
     67    "year/monthCode/day with day need to be constrained in Oct.");
     68 
     69 TemporalHelpers.assertPlainDate(
     70    Temporal.PlainDate.from({year: 2021, monthCode: "M11", day: 133}),
     71    2021, 11, "M11", 30,
     72    "year/monthCode/day with day need to be constrained in Nov.");
     73 
     74 TemporalHelpers.assertPlainDate(
     75    Temporal.PlainDate.from({year: 2021, monthCode: "M12", day: 133}),
     76    2021, 12, "M12", 31,
     77    "year/monthCode/day with day need to be constrained in Dec.");
     78 
     79 reportCompare(0, 0);