Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDate/from/observable-get-overflow-argument-primitive.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) 2021 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.plaindate.from
7 description: overflow property is extracted with string argument.
8 includes: [compareArray.js, temporalHelpers.js]
9 features: [Temporal]
10 ---*/
11
12 const expected = [
13 "get options.overflow",
14 "get options.overflow.toString",
15 "call options.overflow.toString",
16 ];
17
18 let actual = [];
19 const options = TemporalHelpers.propertyBagObserver(actual, { overflow: "reject" }, "options");
20
21 const result = Temporal.PlainDate.from("2021-05-17", options);
22 assert.compareArray(actual, expected, "Successful call");
23 TemporalHelpers.assertPlainDate(result, 2021, 5, "M05", 17);
24
25 actual.splice(0); // empty it for the next check
26
27 assert.throws(TypeError, () => Temporal.PlainDate.from(7, options));
28 assert.compareArray(actual, [], "Failing call before options is processed");
29
30 actual.splice(0);
31
32 assert.throws(RangeError, () => Temporal.PlainDate.from({ year: 2021, month: 2, day: 29 }, options));
33 assert.compareArray(actual, expected, "Failing call after options is processed");
34
35 reportCompare(0, 0);