summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js')
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js b/js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js
new file mode 100644
index 0000000000..c1ef7ef355
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-options-language-valid-undefined.js
@@ -0,0 +1,45 @@
+// Copyright 2018 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verify valid language option values (undefined)
+info: |
+ Intl.Locale( tag [, options] )
+ 10. If options is undefined, then
+ 11. Else
+ a. Let options be ? ToObject(options).
+ 12. Set tag to ? ApplyOptionsToTag(tag, options).
+
+ ApplyOptionsToTag( tag, options )
+
+ 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception.
+ ...
+
+ IsStructurallyValidLanguageTag ( locale )
+
+ The IsStructurallyValidLanguageTag abstract operation verifies that the
+ locale argument (which must be a String value)
+
+ represents a well-formed Unicode BCP 47 Locale Identifier" as specified in
+ Unicode Technical Standard 35 section 3.2, or successor,
+
+features: [Intl.Locale]
+---*/
+
+assert.sameValue(
+ new Intl.Locale('en', {language: undefined}).toString(),
+ 'en',
+ `new Intl.Locale('en', {language: undefined}).toString() returns "en"`
+);
+
+assert.sameValue(
+ new Intl.Locale('en-US', {language: undefined}).toString(),
+ 'en-US',
+ `new Intl.Locale('en-US', {language: undefined}).toString() returns "en-US"`
+);
+
+assert.throws(RangeError, () => new Intl.Locale('en-els', {language: undefined}));
+
+reportCompare(0, 0);