| 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 missing 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 langtag grammar. |
| 13 |
|
| 14 |
get Intl.Locale.prototype.language |
| 15 |
4. Return the substring of locale corresponding to the language production. |
| 16 |
|
| 17 |
get Intl.Locale.prototype.script |
| 18 |
6. If locale does not contain the ["-" script] sequence, return undefined. |
| 19 |
7. Return the substring of locale corresponding to the script production. |
| 20 |
|
| 21 |
get Intl.Locale.prototype.region |
| 22 |
6. If locale does not contain the ["-" region] sequence, return undefined. |
| 23 |
7. Return the substring of locale corresponding to the region production. |
| 24 |
features: [Intl.Locale] |
| 25 |
---*/ |
| 26 |
|
| 27 |
// 'script' and 'region' subtags not present. |
| 28 |
var loc = new Intl.Locale("sv"); |
| 29 |
assert.sameValue(loc.baseName, "sv"); |
| 30 |
assert.sameValue(loc.language, "sv"); |
| 31 |
assert.sameValue(loc.script, undefined); |
| 32 |
assert.sameValue(loc.region, undefined); |
| 33 |
|
| 34 |
// 'region' subtag not present. |
| 35 |
var loc = new Intl.Locale("sv-Latn"); |
| 36 |
assert.sameValue(loc.baseName, "sv-Latn"); |
| 37 |
assert.sameValue(loc.language, "sv"); |
| 38 |
assert.sameValue(loc.script, "Latn"); |
| 39 |
assert.sameValue(loc.region, undefined); |
| 40 |
|
| 41 |
// 'script' subtag not present. |
| 42 |
var loc = new Intl.Locale("sv-SE"); |
| 43 |
assert.sameValue(loc.baseName, "sv-SE"); |
| 44 |
assert.sameValue(loc.language, "sv"); |
| 45 |
assert.sameValue(loc.script, undefined); |
| 46 |
assert.sameValue(loc.region, "SE"); |
| 47 |
|
| 48 |
// 'variant' subtag present. |
| 49 |
var loc = new Intl.Locale("de-1901"); |
| 50 |
assert.sameValue(loc.baseName, "de-1901"); |
| 51 |
assert.sameValue(loc.language, "de"); |
| 52 |
assert.sameValue(loc.script, undefined); |
| 53 |
assert.sameValue(loc.region, undefined); |
| 54 |
|
| 55 |
reportCompare(0, 0); |