mirror of
https://github.com/tc39/test262.git
synced 2025-08-30 06:18:31 +02:00
These tests cover the normative change approved in the July 2025 TC39 plenary. See https://github.com/tc39/proposal-temporal/pull/3130. All properties of user-passed options objects should be read and cast before any "algorithmic validation" is done. This is a lot of tests, that cover every entry point where an options object is passed in, where subsequently an exception can be thrown or user code can be called. However, the normative change only affects 10 of these tests: - Instant.p.since,until,toString - PlainDate.p.since,until - PlainTime.p.since,until - PlainYearMonth.p.since,until - ZonedDateTime.p.toString The other 35 tests simply close a gap in coverage.
27 lines
837 B
JavaScript
27 lines
837 B
JavaScript
// Copyright (C) 2025 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: >
|
|
All options properties are read and cast before any algorithmic validation
|
|
includes: [compareArray.js, temporalHelpers.js]
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const expected = [
|
|
"get options.overflow",
|
|
"get options.overflow.toString",
|
|
"call options.overflow.toString",
|
|
];
|
|
const actual = [];
|
|
|
|
const options = TemporalHelpers.propertyBagObserver(actual, {
|
|
overflow: "constrain",
|
|
}, "options");
|
|
|
|
assert.throws(RangeError, function () {
|
|
Temporal.PlainDate.from({ year: 2025, monthCode: "M08L", day: 14 }, options);
|
|
}, "exception thrown when month code is invalid for calendar");
|
|
assert.compareArray(actual, expected, "all options should be read first");
|