Debian Codegraph @

js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js

raw
1 // Copyright 2018 Rick Waldron. 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 Verify valid language option values (undefined)
8 info: |
9 Intl.Locale( tag [, options] )
10 10. If options is undefined, then
11 11. Else
12 a. Let options be ? ToObject(options).
13 12. Set tag to ? ApplyOptionsToTag(tag, options).
14
15 ApplyOptionsToTag( tag, options )
16
17 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
18 ...
19
20 IsStructurallyValidLanguageTag ( locale )
21
22 The IsStructurallyValidLanguageTag abstract operation verifies that the
23 locale argument (which must be a String value)
24
25 represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
26 Unicode Technical Standard 35 section 3.2, or successor,
27
28 features: [Intl.Locale]
29 ---*/
30
31 assert.sameValue(
32 new Intl.Locale('en', {language: undefined}).toString(),
33 'en',
34 `new Intl.Locale('en', {language: undefined}).toString() returns "en"`
35 );
36
37 assert.sameValue(
38 new Intl.Locale('en-US', {language: undefined}).toString(),
39 'en-US',
40 `new Intl.Locale('en-US', {language: undefined}).toString() returns "en-US"`
41 );
42
43 assert.throws(RangeError, () => new Intl.Locale('en-els', {language: undefined}));
44
45 reportCompare(0, 0);