Debian Codegraph @

js/src/tests/test262/intl402/Segmenter/constructor/supportedLocalesOf/basic.js

raw
1 // |reftest| skip-if(!Intl.Segmenter) -- Intl.Segmenter is not enabled unconditionally
2 // Copyright 2018 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.Segmenter.supportedLocalesOf
7 description: Tests that Intl.Segmenter has a supportedLocalesOf property, and it works as expected.
8 features: [Intl.Segmenter]
9 ---*/
10
11 assert.sameValue(typeof Intl.Segmenter.supportedLocalesOf, "function",
12 "supportedLocalesOf should be supported.");
13
14 const defaultLocale = new Intl.Segmenter().resolvedOptions().locale;
15 const notSupported = "zxx"; // "no linguistic content"
16 const requestedLocales = [defaultLocale, notSupported];
17
18 const supportedLocales = Intl.Segmenter.supportedLocalesOf(requestedLocales);
19 assert.sameValue(supportedLocales.length, 1, "The length of supported locales list is not 1.");
20 assert.sameValue(supportedLocales[0], defaultLocale, "The default locale is not returned in the supported list.");
21
22 reportCompare(0, 0);