summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Locale/constructor-locale-object.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Locale/constructor-locale-object.js')
-rw-r--r--js/src/tests/test262/intl402/Locale/constructor-locale-object.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Locale/constructor-locale-object.js b/js/src/tests/test262/intl402/Locale/constructor-locale-object.js
new file mode 100644
index 0000000000..11760b13c8
--- /dev/null
+++ b/js/src/tests/test262/intl402/Locale/constructor-locale-object.js
@@ -0,0 +1,39 @@
+// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.locale
+description: >
+ Verifies canonicalization of specific tags.
+info: |
+ ApplyOptionsToTag( tag, options )
+ 10. Return CanonicalizeLanguageTag(tag).
+features: [Intl.Locale]
+---*/
+
+// Pass Intl.Locale object and replace subtag.
+const enUS = new Intl.Locale("en-US");
+const enGB = new Intl.Locale(enUS, {region: "GB"});
+
+assert.sameValue(enUS.toString(), "en-US", 'enUS.toString() returns "en-US"');
+assert.sameValue(enGB.toString(), "en-GB", 'enGB.toString() returns "en-GB"');
+
+// Pass Intl.Locale object and replace Unicode extension keyword.
+const zhUnihan = new Intl.Locale("zh-u-co-unihan");
+const zhZhuyin = new Intl.Locale(zhUnihan, {collation: "zhuyin"});
+
+assert.sameValue(
+ zhUnihan.toString(),
+ "zh-u-co-unihan",
+ 'zhUnihan.toString() returns "zh-u-co-unihan"'
+);
+assert.sameValue(
+ zhZhuyin.toString(),
+ "zh-u-co-zhuyin",
+ 'zhZhuyin.toString() returns "zh-u-co-zhuyin"'
+);
+
+assert.sameValue(zhUnihan.collation, "unihan", 'The value of zhUnihan.collation is "unihan"');
+assert.sameValue(zhZhuyin.collation, "zhuyin", 'The value of zhZhuyin.collation is "zhuyin"');
+
+reportCompare(0, 0);