Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainDateTime/from/argument-string-out-of-range.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: Invalid ISO string not acceptable even with overflow = constrain
8 features: [Temporal]
9 ---*/
10
11 assert.throws(
12 RangeError,
13 () => Temporal.PlainDateTime.from("2020-13-34T24:60", {}),
14 "constrain has no effect on invalid ISO string (empty options argument)"
15 );
16
17 assert.throws(
18 RangeError,
19 () => Temporal.PlainDateTime.from("2020-13-34T24:60", () => {}),
20 "constrain has no effect on invalid ISO string (nullary empty object function argument)"
21 );
22
23 assert.throws(
24 RangeError,
25 () => Temporal.PlainDateTime.from("2020-13-34T24:60", {overflow: "constrain"}),
26 "overflow = constrain has no effect on invalid ISO string"
27 );
28
29 assert.throws(
30 RangeError,
31 () => Temporal.PlainDateTime.from("2020-13-34T24:60", {overflow: "reject"}),
32 "overflow = reject has no effect on invalid ISO string"
33 );
34
35 reportCompare(0, 0);