Debian Codegraph @

js/src/tests/test262/intl402/Locale/getters-grandfathered.js

raw
1 // Copyright 2018 André Bargull; 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.locale
6 description: >
7 Verifies getters with grandfathered tags.
8 info: |
9 get Intl.Locale.prototype.baseName
10 5. Return the substring of locale corresponding to the
11 language ["-" script] ["-" region] *("-" variant)
12 subsequence of the unicode_language_id grammar.
13
14 get Intl.Locale.prototype.language
15 5. Return the substring of locale corresponding to the
16 unicode_language_subtag production.
17
18 get Intl.Locale.prototype.script
19 6. Return the substring of locale corresponding to the
20 unicode_script_subtag production.
21
22 get Intl.Locale.prototype.region
23 6. Return the substring of locale corresponding to the unicode_region_subtag
24 production.
25 features: [Intl.Locale]
26 ---*/
27
28 // Regular grandfathered language tag.
29 var loc = new Intl.Locale("cel-gaulish");
30 assert.sameValue(loc.baseName, "xtg");
31 assert.sameValue(loc.language, "xtg");
32 assert.sameValue(loc.script, undefined);
33 assert.sameValue(loc.region, undefined);
34
35 // Regular grandfathered language tag.
36 assert.throws(RangeError, () => new Intl.Locale("zh-min"));
37
38 assert.throws(RangeError, () => new Intl.Locale("i-default"));
39
40
41 reportCompare(0, 0);