Debian Codegraph @

js/src/tests/test262/intl402/Temporal/PlainMonthDay/from/fields-underspecified.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
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.plainmonthday.from
7 description: Throw a RangeError if only one of era/eraYear fields is present
8 features: [Temporal]
9 ---*/
10
11 const tests = [
12 ["gregory", { year: 2000, month: 5, day: 2, era: "ce" }, "era present but not eraYear"],
13 ["gregory", { year: 2000, month: 5, day: 2, eraYear: 1 }, "eraYear present but not era"],
14 ["gregory", { month: 8, day: 1 }, "no monthCode or year specification, non-ISO Gregorian"],
15 ["hebrew", { month: 8, day: 1 }, "no monthCode or year specification, non-ISO non-Gregorian"],
16 ];
17
18 for (const [calendarId, arg, description] of tests) {
19 assert.throws(TypeError, () => Temporal.PlainMonthDay.from({ ...arg, calendar: calendarId }), description);
20 }
21
22 reportCompare(0, 0);