summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainDateTime/from/overflow-default-constrain.js
blob: ba6b9725d3b4d827acd48fc1d518dfdce2d07602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plaindatetime.from
description: By default, overflow = constrain
features: [Temporal]
includes: [temporalHelpers.js]
---*/

const date = {year: 2019, month: 1, day: 32};
const data = [2019, 1, "M01", 31, 0, 0, 0, 0, 0, 0];

TemporalHelpers.assertPlainDateTime(
  Temporal.PlainDateTime.from(date),
  ...data,
  "by default, overflow is constrain (overflow options argument absent)"
);

TemporalHelpers.assertPlainDateTime(
  Temporal.PlainDateTime.from(date, {}),
  ...data,
  "by default, overflow is constrain (options argument is empty plain object)"
);

TemporalHelpers.assertPlainDateTime(
  Temporal.PlainDateTime.from(date, () => {}),
  ...data,
  "by default, overflow is constrain (options argument is empty function)"
);


TemporalHelpers.assertPlainDateTime(
  Temporal.PlainDateTime.from(date, {overflow: "constrain"}),
  ...data,
  "by default, overflow is constrain (overflow options argument present)"
);

reportCompare(0, 0);