Debian Codegraph @

js/src/tests/test262/intl402/DurationFormat/constructor-options-numberingSystem-valid.js

raw
1 // |reftest| skip-if(!Intl.hasOwnProperty('DurationFormat')) -- Intl.DurationFormat is not enabled unconditionally
2 // Copyright 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-Intl.DurationFormat
7 description: >
8 Checks error cases for the options argument to the DurationFormat constructor.
9 info: |
10 Intl.DurationFormat ( [ locales [ , options ] ] )
11 (...)
12 6. Let numberingSystem be ? GetOption(options, "numberingSystem", "string", undefined, undefined).
13 7. If numberingSystem does not match the Unicode Locale Identifier type nonterminal, throw a RangeError exception.
14 features: [Intl.DurationFormat]
15 ---*/
16
17 const numberingSystems = Intl.supportedValuesOf("numberingSystem");
18
19 for (const numberingSystem of numberingSystems) {
20 const obj = new Intl.DurationFormat("en", {numberingSystem});
21 assert.sameValue(obj.resolvedOptions().numberingSystem, numberingSystem, `${numberingSystem} is supported by DurationFormat`);
22 }
23
24 reportCompare(0, 0);