Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDateTime/from/overflow-reject.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) 2022 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.plaindatetime.from
7 description: Possibly throw if overflow is reject
8 features: [Temporal]
9 includes: [temporalHelpers.js]
10 ---*/
11
12 TemporalHelpers.assertPlainDateTime(
13 Temporal.PlainDateTime.from({year: 2019, month: 1, day: 31}, {overflow: "reject"}),
14 2019, 1, "M01", 31, 0, 0, 0, 0, 0, 0,
15 "overflow reject, acceptable argument"
16 );
17
18 assert.throws(
19 RangeError,
20 () => Temporal.PlainDateTime.from({year: 2019, month: 1, day: 32}, {overflow: "reject"}),
21 "overflow reject, unacceptable argument"
22 );
23
24 reportCompare(0, 0);