Debian Codegraph @

js/src/tests/test262/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-undefined.js

raw
1 // Copyright 2018 Igalia, S.L. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-Intl.RelativeTimeFormat.supportedLocalesOf
6 description: Checks handling of an undefined options argument to the supportedLocalesOf function.
7 info: |
8 SupportedLocales ( availableLocales, requestedLocales, options )
9
10 1. If options is not undefined, then
11 b. Let matcher be ? GetOption(options, "localeMatcher", "string", «"lookup", "best fit"», "best fit").
12 features: [Intl.RelativeTimeFormat]
13 ---*/
14
15 assert.sameValue(typeof Intl.RelativeTimeFormat.supportedLocalesOf, "function",
16 "Should support Intl.RelativeTimeFormat.supportedLocalesOf.");
17
18 Object.defineProperties(Object.prototype, {
19 "localeMatcher": {
20 get() { throw new Error("Should not call localeMatcher getter"); }
21 }
22 });
23
24 assert.sameValue(Array.isArray(Intl.RelativeTimeFormat.supportedLocalesOf()), true, "No arguments");
25 assert.sameValue(Array.isArray(Intl.RelativeTimeFormat.supportedLocalesOf([])), true, "One argument");
26 assert.sameValue(Array.isArray(Intl.RelativeTimeFormat.supportedLocalesOf([], undefined)), true, "Two arguments");
27
28 reportCompare(0, 0);