blob: 23f0ffc9c5c173dc48a1e2b0a4499d0e39a17145 [file] [log] [blame]
// 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.protoype.tostring
description: RangeError thrown when calendarName option not one of the allowed string values
info: |
sec-getoption step 10:
10. If _values_ is not *undefined* and _values_ does not contain an element equal to _value_, throw a *RangeError* exception.
sec-temporal-toshowcalendaroption step 1:
1. Return ? GetOption(_normalizedOptions_, *"calendarName"*, « String », « *"auto"*, *"always"*, *"never"* », *"auto"*).
sec-temporal.plainyearmonth.protoype.tostring step 4:
4. Let _showCalendar_ be ? ToShowCalendarOption(_options_).
features: [Temporal]
---*/
const yearmonth = new Temporal.PlainYearMonth(2000, 5);
for (const calendarName of ["ALWAYS", "sometimes", "other string"]) {
assert.throws(RangeError, () => yearmonth.toString({ calendarName }));
}