summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/ch11/11.2
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/test262/intl402/ch11/11.2
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/intl402/ch11/11.2')
-rw-r--r--js/src/tests/test262/intl402/ch11/11.2/11.2.1.js22
-rw-r--r--js/src/tests/test262/intl402/ch11/11.2/11.2.2_L15.js14
-rw-r--r--js/src/tests/test262/intl402/ch11/11.2/11.2.2_a.js28
-rw-r--r--js/src/tests/test262/intl402/ch11/11.2/11.2.2_b.js13
-rw-r--r--js/src/tests/test262/intl402/ch11/11.2/11.2.3_b.js46
-rw-r--r--js/src/tests/test262/intl402/ch11/11.2/browser.js0
-rw-r--r--js/src/tests/test262/intl402/ch11/11.2/shell.js0
7 files changed, 123 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/ch11/11.2/11.2.1.js b/js/src/tests/test262/intl402/ch11/11.2/11.2.1.js
new file mode 100644
index 000000000..83bebb283
--- /dev/null
+++ b/js/src/tests/test262/intl402/ch11/11.2/11.2.1.js
@@ -0,0 +1,22 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/**
+ * @description Tests that Intl.NumberFormat.prototype has the required attributes.
+ * @author Norbert Lindenberg
+ */
+
+var desc = Object.getOwnPropertyDescriptor(Intl.NumberFormat, "prototype");
+if (desc === undefined) {
+ $ERROR("Intl.NumberFormat.prototype is not defined.");
+}
+if (desc.writable) {
+ $ERROR("Intl.NumberFormat.prototype must not be writable.");
+}
+if (desc.enumerable) {
+ $ERROR("Intl.NumberFormat.prototype must not be enumerable.");
+}
+if (desc.configurable) {
+ $ERROR("Intl.NumberFormat.prototype must not be configurable.");
+}
+
diff --git a/js/src/tests/test262/intl402/ch11/11.2/11.2.2_L15.js b/js/src/tests/test262/intl402/ch11/11.2/11.2.2_L15.js
new file mode 100644
index 000000000..49dce3bae
--- /dev/null
+++ b/js/src/tests/test262/intl402/ch11/11.2/11.2.2_L15.js
@@ -0,0 +1,14 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/**
+ * @description Tests that Intl.NumberFormat.supportedLocalesOf
+ * meets the requirements for built-in objects defined by the introduction of
+ * chapter 15 of the ECMAScript Language Specification.
+ * @author Norbert Lindenberg
+ */
+
+$INCLUDE("testBuiltInObject.js");
+
+testBuiltInObject(Intl.NumberFormat.supportedLocalesOf, true, false, [], 1);
+
diff --git a/js/src/tests/test262/intl402/ch11/11.2/11.2.2_a.js b/js/src/tests/test262/intl402/ch11/11.2/11.2.2_a.js
new file mode 100644
index 000000000..c6c9f9a46
--- /dev/null
+++ b/js/src/tests/test262/intl402/ch11/11.2/11.2.2_a.js
@@ -0,0 +1,28 @@
+// Copyright 2012 Google Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * @description Tests that Intl.NumberFormat has a supportedLocalesOf
+ * property, and it works as planned.
+ * @author: Roozbeh Pournader
+ */
+
+var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
+var notSupported = 'zxx'; // "no linguistic content"
+var requestedLocales = [defaultLocale, notSupported];
+
+var supportedLocales;
+
+if (!Intl.NumberFormat.hasOwnProperty('supportedLocalesOf')) {
+ $ERROR("Intl.NumberFormat doesn't have a supportedLocalesOf property.");
+}
+
+supportedLocales = Intl.NumberFormat.supportedLocalesOf(requestedLocales);
+if (supportedLocales.length !== 1) {
+ $ERROR('The length of supported locales list is not 1.');
+}
+
+if (supportedLocales[0] !== defaultLocale) {
+ $ERROR('The default locale is not returned in the supported list.');
+}
+
diff --git a/js/src/tests/test262/intl402/ch11/11.2/11.2.2_b.js b/js/src/tests/test262/intl402/ch11/11.2/11.2.2_b.js
new file mode 100644
index 000000000..6b4d77e77
--- /dev/null
+++ b/js/src/tests/test262/intl402/ch11/11.2/11.2.2_b.js
@@ -0,0 +1,13 @@
+// Copyright 2013 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/**
+ * @description Tests that Intl.NumberFormat.supportedLocalesOf
+ * doesn't access arguments that it's not given.
+ * @author Norbert Lindenberg
+ */
+
+$INCLUDE("testIntl.js");
+
+taintDataProperty(Object.prototype, "1");
+new Intl.NumberFormat("und");
diff --git a/js/src/tests/test262/intl402/ch11/11.2/11.2.3_b.js b/js/src/tests/test262/intl402/ch11/11.2/11.2.3_b.js
new file mode 100644
index 000000000..70fe7cf11
--- /dev/null
+++ b/js/src/tests/test262/intl402/ch11/11.2/11.2.3_b.js
@@ -0,0 +1,46 @@
+// Copyright 2012 Mozilla Corporation. All rights reserved.
+// This code is governed by the license found in the LICENSE file.
+
+/**
+ * @description Tests that Intl.NumberFormat does not accept Unicode locale
+ * extension keys and values that are not allowed.
+ * @author Norbert Lindenberg
+ */
+
+$INCLUDE("testIntl.js");
+
+var locales = ["ja-JP", "zh-Hans-CN", "zh-Hant-TW"];
+var input = 1234567.89;
+
+locales.forEach(function (locale) {
+ var defaultNumberFormat = new Intl.NumberFormat([locale]);
+ var defaultOptions = defaultNumberFormat.resolvedOptions();
+ var defaultOptionsJSON = JSON.stringify(defaultOptions);
+ var defaultLocale = defaultOptions.locale;
+ var defaultFormatted = defaultNumberFormat.format(input);
+
+ var keyValues = {
+ "cu": ["USD", "EUR", "JPY", "CNY", "TWD", "invalid"],
+ "nu": ["native", "traditio", "finance", "invalid"]
+ };
+
+ Object.getOwnPropertyNames(keyValues).forEach(function (key) {
+ keyValues[key].forEach(function (value) {
+ var numberFormat = new Intl.NumberFormat([locale + "-u-" + key + "-" + value]);
+ var options = numberFormat.resolvedOptions();
+ if (options.locale !== defaultLocale) {
+ $ERROR("Locale " + options.locale + " is affected by key " +
+ key + "; value " + value + ".");
+ }
+ if (JSON.stringify(options) !== defaultOptionsJSON) {
+ $ERROR("Resolved options " + JSON.stringify(options) + " are affected by key " +
+ key + "; value " + value + ".");
+ }
+ if (defaultFormatted !== numberFormat.format(input)) {
+ $ERROR("Formatted value " + numberFormat.format(input) + " is affected by key " +
+ key + "; value " + value + ".");
+ }
+ });
+ });
+});
+
diff --git a/js/src/tests/test262/intl402/ch11/11.2/browser.js b/js/src/tests/test262/intl402/ch11/11.2/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/intl402/ch11/11.2/browser.js
diff --git a/js/src/tests/test262/intl402/ch11/11.2/shell.js b/js/src/tests/test262/intl402/ch11/11.2/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/intl402/ch11/11.2/shell.js