Debian Codegraph @

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