summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/limits.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/limits.js')
-rw-r--r--js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/limits.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/limits.js b/js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/limits.js
new file mode 100644
index 0000000000..78fc602c1e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/limits.js
@@ -0,0 +1,22 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2021 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.plainyearmonth.prototype.toplaindate
+description: Throws a RangeError if the resulting PlainDate is out of range
+includes: [temporalHelpers.js]
+features: [Temporal]
+---*/
+
+const min = Temporal.PlainYearMonth.from("-271821-04");
+assert.throws(RangeError, () => min.toPlainDate({ day: 18 }), "min");
+TemporalHelpers.assertPlainDate(min.toPlainDate({ day: 19 }),
+ -271821, 4, "M04", 19, "min");
+
+const max = Temporal.PlainYearMonth.from("+275760-09");
+assert.throws(RangeError, () => max.toPlainDate({ day: 14 }), "max");
+TemporalHelpers.assertPlainDate(max.toPlainDate({ day: 13 }),
+ 275760, 9, "M09", 13, "max");
+
+reportCompare(0, 0);