summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/add/limits.js
blob: 190bb5bbdadd24c7609a0554d5e2dc680cd081aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// |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.plainyearmonth.prototype.add
description: RangeError thrown when going out of range
features: [Temporal]
---*/

const max = Temporal.PlainYearMonth.from("+275760-09");
for (const overflow of ["reject", "constrain"]) {
  assert.throws(RangeError, () => max.add({ months: 1 }, { overflow }), overflow);
}

reportCompare(0, 0);