Temporal: Add tests for fast path in ToTemporalCalendar

Normally, a plain object passed into an API that takes a Temporal.Calendar
has its 'calendar' property checked (observably) with a Has operation
followed by a Get operation if the property is present. In the normative
change https://github.com/tc39/proposal-temporal/pull/2392 which reached
consensus at the September 2022 TC39 meeting, this was changed so that
this check is skipped for objects which have the Temporal.Calendar
internal slots.

This adds tests to all entry points that pass a user-supplied object to
ToTemporalCalendar, with a "poisoned" calendar object which has the
correct internal slots but a 'calendar' accessor property whose getter
throws. A correct implementation should not cause this getter to throw.
This commit is contained in:
Philip Chimento 2022-10-11 18:06:42 -07:00 committed by Ms2ger
parent fefa14c285
commit 34805283d9
58 changed files with 1363 additions and 0 deletions

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.from
description: >
A Temporal.Calendar instance passed to from() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
Temporal.Calendar.from(arg);
Temporal.Calendar.from({ calendar: arg });

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.dateadd
description: >
A Temporal.Calendar instance passed to dateAdd() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.dateAdd(arg, new Temporal.Duration());
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.dateAdd(arg, new Temporal.Duration());

View File

@ -0,0 +1,22 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.dateuntil
description: >
A Temporal.Calendar instance passed to dateUntil() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.dateUntil(arg, arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.day
description: >
A Temporal.Calendar instance passed to day() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.day(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.day(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.dayofweek
description: >
A Temporal.Calendar instance passed to dayOfWeek() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.dayOfWeek(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.dayOfWeek(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.dayofyear
description: >
A Temporal.Calendar instance passed to dayOfYear() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.dayOfYear(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.dayOfYear(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.daysinmonth
description: >
A Temporal.Calendar instance passed to daysInMonth() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.daysInMonth(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.daysInMonth(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.daysinweek
description: >
A Temporal.Calendar instance passed to daysInWeek() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.daysInWeek(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.daysInWeek(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.daysinyear
description: >
A Temporal.Calendar instance passed to daysInYear() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.daysInYear(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.daysInYear(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.inleapyear
description: >
A Temporal.Calendar instance passed to inLeapYear() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.inLeapYear(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.inLeapYear(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.month
description: >
A Temporal.Calendar instance passed to month() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.month(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.month(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.monthcode
description: >
A Temporal.Calendar instance passed to monthCode() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.monthCode(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.monthCode(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.monthsinyear
description: >
A Temporal.Calendar instance passed to monthsInYear() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.monthsInYear(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.monthsInYear(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.weekofyear
description: >
A Temporal.Calendar instance passed to weekOfYear() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.weekOfYear(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.weekOfYear(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.year
description: >
A Temporal.Calendar instance passed to year() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.year(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.year(arg);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.instant.prototype.tozoneddatetime
description: >
A Temporal.Calendar instance passed to toZonedDateTime() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Instant(1_000_000_000_000_000_000n);
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
instance.toZonedDateTime({ calendar: arg, timeZone: "UTC" });
instance.toZonedDateTime({ calendar: { calendar: arg }, timeZone: "UTC" });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.plaindate
description: >
A Temporal.Calendar instance passed to plainDate() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
Temporal.Now.plainDate(arg);
Temporal.Now.plainDate({ calendar: arg });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.plaindatetime
description: >
A Temporal.Calendar instance passed to plainDateTime() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
Temporal.Now.plainDateTime(arg);
Temporal.Now.plainDateTime({ calendar: arg });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.zoneddatetime
description: >
A Temporal.Calendar instance passed to zonedDateTime() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
Temporal.Now.zonedDateTime(arg);
Temporal.Now.zonedDateTime({ calendar: arg });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate
description: >
A Temporal.Calendar instance passed to new PlainDate() does not have
its 'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
new Temporal.PlainDate(2000, 5, 2, arg);
new Temporal.PlainDate(2000, 5, 2, { calendar: arg });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.compare
description: >
A Temporal.Calendar instance passed to compare() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
Temporal.PlainDate.compare(arg, arg);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.from
description: >
A Temporal.Calendar instance passed to from() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
Temporal.PlainDate.from(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
Temporal.PlainDate.from(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.prototype.equals
description: >
A Temporal.Calendar instance passed to equals() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(1976, 11, 18);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.equals(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.equals(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.prototype.since
description: >
A Temporal.Calendar instance passed to since() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(1976, 11, 18);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.since(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.since(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.prototype.until
description: >
A Temporal.Calendar instance passed to until() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(1976, 11, 18);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.until(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.until(arg);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindate.prototype.withcalendar
description: >
A Temporal.Calendar instance passed to withCalendar() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDate(1976, 11, 18, { id: "replace-me" });
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
instance.withCalendar(arg);
instance.withCalendar({ calendar: arg });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime
description: >
A Temporal.Calendar instance passed to new PlainDateTime() does not have
its 'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, arg);
new Temporal.PlainDateTime(2000, 5, 2, 15, 23, 30, 987, 654, 321, { calendar: arg });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.compare
description: >
A Temporal.Calendar instance passed to compare() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
const arg = { year: 1976, monthCode: "M11", day: 18, calendar };
Temporal.PlainDateTime.compare(arg, arg);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.from
description: >
A Temporal.Calendar instance passed to from() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
Temporal.PlainDateTime.from(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
Temporal.PlainDateTime.from(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.prototype.equals
description: >
A Temporal.Calendar instance passed to equals() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(1976, 11, 18);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.equals(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.equals(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.prototype.since
description: >
A Temporal.Calendar instance passed to since() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(1976, 11, 18);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.since(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.since(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.prototype.until
description: >
A Temporal.Calendar instance passed to until() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(1976, 11, 18);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.until(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.until(arg);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.prototype.withcalendar
description: >
A Temporal.Calendar instance passed to withCalendar() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789, { id: "replace-me" });
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
instance.withCalendar(arg);
instance.withCalendar({ calendar: arg });

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaindatetime.prototype.withplaindate
description: >
A Temporal.Calendar instance passed to withPlainDate() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.withPlainDate(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.withPlainDate(arg);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainmonthday
description: >
A Temporal.Calendar instance passed to new PlainMonthDay() does not have
its 'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
new Temporal.PlainMonthDay(12, 15, arg, 1972);
new Temporal.PlainMonthDay(12, 15, { calendar: arg }, 1972);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainmonthday.from
description: >
A Temporal.Calendar instance passed to from() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { monthCode: "M11", day: 18, calendar };
Temporal.PlainMonthDay.from(arg);
arg = { monthCode: "M11", day: 18, calendar: { calendar } };
Temporal.PlainMonthDay.from(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainmonthday.prototype.equals
description: >
A Temporal.Calendar instance passed to equals() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainMonthDay(11, 18);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { monthCode: "M11", day: 18, calendar };
instance.equals(arg);
arg = { monthCode: "M11", day: 18, calendar: { calendar } };
instance.equals(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaintime.prototype.toplaindatetime
description: >
A Temporal.Calendar instance passed to toPlainDateTime() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.toPlainDateTime(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.toPlainDateTime(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plaintime.prototype.tozoneddatetime
description: >
A Temporal.Calendar instance passed to toZonedDateTime() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.toZonedDateTime({ plainDate: arg, timeZone: "UTC" });

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth
description: >
A Temporal.Calendar instance passed to new PlainYearMonth() does not have
its 'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
new Temporal.PlainYearMonth(2000, 5, arg, 1);
new Temporal.PlainYearMonth(2000, 5, { calendar: arg }, 1);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth.compare
description: >
A Temporal.Calendar instance passed to compare() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
const arg = { year: 2019, monthCode: "M06", calendar };
Temporal.PlainYearMonth.compare(arg, arg);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth.from
description: >
A Temporal.Calendar instance passed to from() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 2019, monthCode: "M06", calendar };
Temporal.PlainYearMonth.from(arg);
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
Temporal.PlainYearMonth.from(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth.prototype.equals
description: >
A Temporal.Calendar instance passed to equals() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainYearMonth(2019, 6);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 2019, monthCode: "M06", calendar };
instance.equals(arg);
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
instance.equals(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth.prototype.since
description: >
A Temporal.Calendar instance passed to since() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainYearMonth(2019, 6);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 2019, monthCode: "M06", calendar };
instance.since(arg);
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
instance.since(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.plainyearmonth.prototype.until
description: >
A Temporal.Calendar instance passed to until() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.PlainYearMonth(2019, 6);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 2019, monthCode: "M06", calendar };
instance.until(arg);
arg = { year: 2019, monthCode: "M06", calendar: { calendar } };
instance.until(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.timezone.prototype.getinstantfor
description: >
A Temporal.Calendar instance passed to getInstantFor() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.TimeZone("UTC");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.getInstantFor(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.getInstantFor(arg);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.timezone.prototype.getplaindatetimefor
description: >
A Temporal.Calendar instance passed to getPlainDateTimeFor() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.TimeZone("UTC");
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
instance.getPlainDateTimeFor(new Temporal.Instant(0n), arg);
instance.getPlainDateTimeFor(new Temporal.Instant(0n), { calendar: arg });

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.timezone.prototype.getpossibleinstantsfor
description: >
A Temporal.Calendar instance passed to getPossibleInstantsFor() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.TimeZone("UTC");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.getPossibleInstantsFor(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.getPossibleInstantsFor(arg);

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime
description: >
A Temporal.Calendar instance passed to new ZonedDateTime() does not have
its 'calendar' property observably checked
features: [Temporal]
---*/
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
new Temporal.ZonedDateTime(0n, "UTC", arg);
new Temporal.ZonedDateTime(0n, "UTC", { calendar: arg });

View File

@ -0,0 +1,21 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.compare
description: >
A Temporal.Calendar instance passed to compare() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
const timeZone = new Temporal.TimeZone("UTC");
const arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
Temporal.ZonedDateTime.compare(arg, arg);

View File

@ -0,0 +1,24 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.from
description: >
A Temporal.Calendar instance passed to from() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
const timeZone = new Temporal.TimeZone("UTC");
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
Temporal.ZonedDateTime.from(arg);
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
Temporal.ZonedDateTime.from(arg);

View File

@ -0,0 +1,26 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.prototype.equals
description: >
A Temporal.Calendar instance passed to equals() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
instance.equals(arg);
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
instance.equals(arg);

View File

@ -0,0 +1,26 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.prototype.since
description: >
A Temporal.Calendar instance passed to since() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
instance.since(arg);
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
instance.since(arg);

View File

@ -0,0 +1,26 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.prototype.until
description: >
A Temporal.Calendar instance passed to until() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(0n, timeZone);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar };
instance.until(arg);
arg = { year: 1970, monthCode: "M01", day: 1, timeZone, calendar: { calendar } };
instance.until(arg);

View File

@ -0,0 +1,22 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.prototype.withcalendar
description: >
A Temporal.Calendar instance passed to withCalendar() does not have its
'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, "UTC", { id: "replace-me" });
const arg = new Temporal.Calendar("iso8601");
Object.defineProperty(arg, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
instance.withCalendar(arg);
instance.withCalendar({ calendar: arg });

View File

@ -0,0 +1,26 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.zoneddatetime.prototype.withplaindate
description: >
A Temporal.Calendar instance passed to withPlainDate() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const timeZone = new Temporal.TimeZone("UTC");
const instance = new Temporal.ZonedDateTime(1_000_000_000_000_000_000n, timeZone);
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.withPlainDate(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.withPlainDate(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.era
description: >
A Temporal.Calendar instance passed to era() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.era(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.era(arg);

View File

@ -0,0 +1,25 @@
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.calendar.prototype.erayear
description: >
A Temporal.Calendar instance passed to eraYear() in a property bag does
not have its 'calendar' property observably checked
features: [Temporal]
---*/
const instance = new Temporal.Calendar("iso8601");
const calendar = new Temporal.Calendar("iso8601");
Object.defineProperty(calendar, "calendar", {
get() {
throw new Test262Error("calendar.calendar should not be accessed");
},
});
let arg = { year: 1976, monthCode: "M11", day: 18, calendar };
instance.eraYear(arg);
arg = { year: 1976, monthCode: "M11", day: 18, calendar: { calendar } };
instance.eraYear(arg);