aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNorbert Lindenberg <ecmascript@lindenbergsoftware.com>2012-08-22 17:53:26 -0700
committerNorbert Lindenberg <ecmascript@lindenbergsoftware.com>2012-08-22 17:53:26 -0700
commitc3111850e31e9778bc7b32dca05200e84355ef3c (patch)
tree2209cc34ae5caca04afaeadbf7483c7d2c2d8065 /test
parent9f4a513496939972d535d32405c9173d06d48259 (diff)
Updated existing tests for June 2012 spec changes; removed LocaleList tests; fixed minor issues.
- Removed LocaleList tests; updated other tests so they don't depend on LocaleList. - Updated tests so they no longer assume that the prototype object of a constructor is an instance of that constructor. - Updated tests so that jshint is happy. - Removed @path attributes from test files; updated comment in packager.py explaining why they're unnecessary. - Removed "use strict" statements, which interfere with strict/non-strict testing. - Removed testcase functions, which are unnecessary.
Diffstat (limited to 'test')
-rw-r--r--test/suite/intl402/ch01/1.2/1.2-1_1.js28
-rw-r--r--test/suite/intl402/ch08/8.0/8.0.js56
-rw-r--r--test/suite/intl402/ch08/8.1/8.1.js37
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.1_1.js23
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.1_2_1.js23
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.1_2_2.js23
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.1_2_3.js23
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.1_2_4.js30
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.1_2_5.js28
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.2.js30
-rw-r--r--test/suite/intl402/ch09/9.1/9.1.3.js30
-rw-r--r--test/suite/intl402/ch11/11.2/11.2.1.js27
-rw-r--r--test/suite/intl402/ch11/11.2/11.2.2.js33
-rw-r--r--test/suite/intl402/ch11/11.2/11.2.3.js23
-rw-r--r--test/suite/intl402/ch11/11.2/11.2.js15
-rw-r--r--test/suite/intl402/ch11/11.3/11.3.1.js11
-rw-r--r--test/suite/intl402/ch11/11.3/11.3.js21
-rw-r--r--test/suite/intl402/ch12/12.2/12.2.1.js27
-rw-r--r--test/suite/intl402/ch12/12.2/12.2.2.js33
-rw-r--r--test/suite/intl402/ch12/12.2/12.2.3.js25
-rw-r--r--test/suite/intl402/ch12/12.2/12.2.js15
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.1.js15
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.2_2.js25
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.2_3.js17
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.2_4.js51
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.2_5_b.js29
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.2_5_e.js25
-rw-r--r--test/suite/intl402/ch12/12.3/12.3.js21
-rw-r--r--test/suite/intl402/ch13/13.2/13.2.1.js27
-rw-r--r--test/suite/intl402/ch13/13.2/13.2.2.js33
-rw-r--r--test/suite/intl402/ch13/13.2/13.2.3.js25
-rw-r--r--test/suite/intl402/ch13/13.2/13.2.js15
-rw-r--r--test/suite/intl402/ch13/13.3/13.3.1.js15
-rw-r--r--test/suite/intl402/ch13/13.3/13.3.js21
34 files changed, 231 insertions, 649 deletions
diff --git a/test/suite/intl402/ch01/1.2/1.2-1_1.js b/test/suite/intl402/ch01/1.2/1.2-1_1.js
deleted file mode 100644
index fa94298cf..000000000
--- a/test/suite/intl402/ch01/1.2/1.2-1_1.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/// Copyright (c) 2012 Ecma International. All rights reserved.
-/// Ecma International makes this code available under the terms and conditions set
-/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
-/// "Use Terms"). Any redistribution of this code must retain the above
-/// copyright and this notice and otherwise comply with the Use Terms.
-
-/**
- * @path intl402/ch01/1.2/1.2-1_1.js
- * @description This is an example showing how to create Ecma standard 402 tests alongside test262 tests. Should be removed once the 402 effort gets underway
- */
-
-//The first test case for a hypothetical Step 1 of section 1.2 in the Ecma
-//standard 402. Yay!
-
-function testcase() {
- "use strict";
-
- //whether the test case passed or failed
- var passed = false;
-
- //Here is where you'd actually test Step 1 of section 1.2 of the
- //hypothetical standard. If the test passed against an
- //implementation, you'd set passed to 'true'.
- passed = true;
-
- return passed;
-}
-runTestCase(testcase);
diff --git a/test/suite/intl402/ch08/8.0/8.0.js b/test/suite/intl402/ch08/8.0/8.0.js
index 5f68283e5..e35db5dff 100644
--- a/test/suite/intl402/ch08/8.0/8.0.js
+++ b/test/suite/intl402/ch08/8.0/8.0.js
@@ -2,48 +2,38 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch08/8.0/8.0.js
* @description Tests properties of Intl object.
*/
-function testcase() {
- "use strict";
-
- var passed = false;
-
- // We keep Intl extensible and not frozen.
- if (Object.isFrozen(Intl) === true) {
- $ERROR('isFrozen(Intl) returns true.')
- }
+// We keep Intl extensible and not frozen.
+if (Object.isFrozen(Intl) === true) {
+ $ERROR('isFrozen(Intl) returns true.');
+}
- if (Object.isExtensible(Intl) === false) {
- $ERROR('isExtensible(Intl) returns false.')
- }
+if (Object.isExtensible(Intl) === false) {
+ $ERROR('isExtensible(Intl) returns false.');
+}
- var falsey = undefined;
+var falsey;
- // Intl can't be constructed.
- try {
+// Intl can't be constructed.
+try {
falsey = new Intl();
- } catch (e) {
- }
+} catch (e) {
+}
- if (!!falsey) {
- $ERROR('Intl object should not be constructable.')
- }
+if (!!falsey) {
+ $ERROR('Intl object should not be constructable.');
+}
- // Intl can't be called as a function.
- try {
+// Intl can't be called as a function.
+try {
+ /*jshint newcap:false*/
falsey = Intl();
- } catch (e) {
- }
-
- if (!!falsey) {
- $ERROR('Intl should not be callable.')
- }
+} catch (e) {
+}
- passed = true;
-
- return passed;
+if (!!falsey) {
+ $ERROR('Intl should not be callable.');
}
-runTestCase(testcase); \ No newline at end of file
+
diff --git a/test/suite/intl402/ch08/8.1/8.1.js b/test/suite/intl402/ch08/8.1/8.1.js
index 570f4e1fe..f9ee77111 100644
--- a/test/suite/intl402/ch08/8.1/8.1.js
+++ b/test/suite/intl402/ch08/8.1/8.1.js
@@ -2,37 +2,22 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch08/8.1/8.1.js
* @description Tests that Intl object has proper constructors.
*/
-function testcase() {
- "use strict";
-
- var passed = false;
-
- if (Intl === undefined) {
+if (Intl === undefined) {
$ERROR('Intl object is undefined.');
- }
-
- if (typeof Intl.LocaleList !== 'function') {
- $ERROR('Intl.LocaleList is not a function.')
- }
-
- if (typeof Intl.Collator !== 'function') {
- $ERROR('Intl.Collator is not a function.')
- }
+}
- if (typeof Intl.NumberFormat !== 'function') {
- $ERROR('Intl.NumberFormat is not a function.')
- }
+if (typeof Intl.Collator !== 'function') {
+ $ERROR('Intl.Collator is not a function.');
+}
- if (typeof Intl.DateTimeFormat !== 'function') {
- $ERROR('Intl.DateTimeFormat is not a function.')
- }
+if (typeof Intl.NumberFormat !== 'function') {
+ $ERROR('Intl.NumberFormat is not a function.');
+}
- passed = true;
-
- return passed;
+if (typeof Intl.DateTimeFormat !== 'function') {
+ $ERROR('Intl.DateTimeFormat is not a function.');
}
-runTestCase(testcase); \ No newline at end of file
+
diff --git a/test/suite/intl402/ch09/9.1/9.1.1_1.js b/test/suite/intl402/ch09/9.1/9.1.1_1.js
deleted file mode 100644
index 281e6f062..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.1_1.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.1_1.js
- * @description Tests initialization of LocaleList object with no parameters.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = new Intl.LocaleList();
- if (list.length !== 1) {
- $ERROR('LocaleList constructed with no arguments should have 1 element.');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_1.js b/test/suite/intl402/ch09/9.1/9.1.1_2_1.js
deleted file mode 100644
index f96aa7735..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.1_2_1.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.1_2_1.js
- * @description Tests initialization of LocaleList object with an empty list.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = new Intl.LocaleList([]);
- if (list.length !== 0) {
- $ERROR('LocaleList constructed with empty list should have 0 elements.');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_2.js b/test/suite/intl402/ch09/9.1/9.1.1_2_2.js
deleted file mode 100644
index c5d6655c8..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.1_2_2.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.1_2_2.js
- * @description Tests initialization of LocaleList object with duplicate language IDs.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = new Intl.LocaleList(['sr-rs', 'sr-rs']);
- if (list.length !== 1) {
- $ERROR('Duplicates should be removed from the list.');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_3.js b/test/suite/intl402/ch09/9.1/9.1.1_2_3.js
deleted file mode 100644
index 6932ebb73..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.1_2_3.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.1_2_3.js
- * @description Tests that language ID gets canonicalized in LocaleList.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = new Intl.LocaleList(['SR-CYRL-rS']);
- if (list[0] !== 'sr-Cyrl-RS') {
- $ERROR('Locale ' + list[0] + ' was not properly canonicalized.');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_4.js b/test/suite/intl402/ch09/9.1/9.1.1_2_4.js
deleted file mode 100644
index a8d7a870a..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.1_2_4.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.1_2_4.js
- * @description Tests initialization of LocaleList object with non-string parameters.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = undefined;
- try {
- list = new Intl.LocaleList([5]);
- } catch(e) {
- if (!(e instanceof TypeError)) {
- $ERROR('LocaleList should throw TypeError exception for non-string argument.');
- }
- }
- if (list !== undefined) {
- $ERROR('LocaleList should throw TypeError exception for non-string argument.');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_5.js b/test/suite/intl402/ch09/9.1/9.1.1_2_5.js
deleted file mode 100644
index b09a57983..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.1_2_5.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.1_2_5.js
- * @description Tests initialization of LocaleList object with invalid locale IDs.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = undefined;
- try {
- list = new Intl.LocaleList(['']);
- } catch(e) {
- // Throws invalid language tag exception.
- }
- if (list !== undefined) {
- $ERROR('Empty string should be an invalid locale identifier.');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch09/9.1/9.1.2.js b/test/suite/intl402/ch09/9.1/9.1.2.js
deleted file mode 100644
index 7be1ec312..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.2.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.2.js
- * @description Tests Intl.LocaleList as a function.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = Intl.LocaleList();
-
- if (list.length !== 1) {
- $ERROR('LocaleList constructed with no arguments should have 1 element.');
- }
-
- // Using new Intl.LocaleList and calling Intl.LocaleList should produce the
- // same result.
- if (new Intl.LocaleList()[0] !== list[0]) {
- $ERROR('Intl.LocaleList()[0] should be equal to new Intl.LocaleList()[0]');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch09/9.1/9.1.3.js b/test/suite/intl402/ch09/9.1/9.1.3.js
deleted file mode 100644
index d1bb7e081..000000000
--- a/test/suite/intl402/ch09/9.1/9.1.3.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2012 Google Inc. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/**
- * @path intl402/ch09/9.1/9.1.3.js
- * @description Tests Intl.LocaleList as a constructor.
- */
-
-function testcase() {
- "use strict";
-
- var passed = false;
-
- var list = new Intl.LocaleList();
-
- if (list.length !== 1) {
- $ERROR('LocaleList constructed with no arguments should have 1 element.');
- }
-
- // Using new Intl.LocaleList and calling Intl.LocaleList should produce the
- // same result.
- if (Intl.LocaleList()[0] !== list[0]) {
- $ERROR('Intl.LocaleList()[0] should be equal to new Intl.LocaleList()[0]');
- }
-
- passed = true;
-
- return passed;
-}
-runTestCase(testcase); \ No newline at end of file
diff --git a/test/suite/intl402/ch11/11.2/11.2.1.js b/test/suite/intl402/ch11/11.2/11.2.1.js
index e5ceb08fc..6583bed08 100644
--- a/test/suite/intl402/ch11/11.2/11.2.1.js
+++ b/test/suite/intl402/ch11/11.2/11.2.1.js
@@ -2,31 +2,24 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch11/11.2/11.2.1.js
* @description Tests that the Intl.Collator prototype object exists and
* is not writable, enumerable, or configurable.
*/
-var testcase = function() {
- "use strict";
+var desc;
- var desc;
-
- if (!Intl.Collator.hasOwnProperty('prototype')) {
+if (!Intl.Collator.hasOwnProperty('prototype')) {
$ERROR('Intl.Collator has no prototype property');
- }
+}
- desc = Object.getOwnPropertyDescriptor(Intl.Collator, 'prototype');
- if (desc.writable === true) {
+desc = Object.getOwnPropertyDescriptor(Intl.Collator, 'prototype');
+if (desc.writable === true) {
$ERROR('Intl.Collator.prototype is writable.');
- }
- if (desc.enumerable === true) {
+}
+if (desc.enumerable === true) {
$ERROR('Intl.Collator.prototype is enumerable.');
- }
- if (desc.configurable === true) {
+}
+if (desc.configurable === true) {
$ERROR('Intl.Collator.prototype is configurable.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch11/11.2/11.2.2.js b/test/suite/intl402/ch11/11.2/11.2.2.js
index 9d136f77e..5cf953ce8 100644
--- a/test/suite/intl402/ch11/11.2/11.2.2.js
+++ b/test/suite/intl402/ch11/11.2/11.2.2.js
@@ -2,33 +2,26 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch11/11.2/11.2.2.js
- * @description Tests that the Intl.Collator has a supportedLocalesOf
+ * @description Tests that Intl.Collator has a supportedLocalesOf
* property, and it works as planned.
*/
-var testcase = function() {
- "use strict";
+var defaultLocale = new Intl.Collator().resolvedOptions().locale;
+var notSupported = 'zxx'; // "no linguistic content"
+var requestedLocales = [defaultLocale, notSupported];
- var supported = (new Intl.LocaleList())[0];
- var notSupported = 'zxx';
- var requestedLocales = [supported, notSupported];
+var supportedLocales;
- var supportedLocales;
-
- if (!Intl.Collator.hasOwnProperty('supportedLocalesOf')) {
+if (!Intl.Collator.hasOwnProperty('supportedLocalesOf')) {
$ERROR("Intl.Collator doesn't have a supportedLocalesOf property.");
- }
+}
- supportedLocales = Intl.Collator.supportedLocalesOf(requestedLocales);
- if (supportedLocales.length !== 1) {
+supportedLocales = Intl.Collator.supportedLocalesOf(requestedLocales);
+if (supportedLocales.length !== 1) {
$ERROR('The length of supported locales list is not 1.');
- }
-
- if (supportedLocales[0] !== supported) {
- $ERROR('The supported locale is not returned in the supported list.');
- }
+}
- return true;
+if (supportedLocales[0] !== defaultLocale) {
+ $ERROR('The default locale is not returned in the supported list.');
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch11/11.2/11.2.3.js b/test/suite/intl402/ch11/11.2/11.2.3.js
index 98ee05b9b..c281491a0 100644
--- a/test/suite/intl402/ch11/11.2/11.2.3.js
+++ b/test/suite/intl402/ch11/11.2/11.2.3.js
@@ -2,24 +2,17 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch11/11.2/11.2.3.js
- * @description Tests the internal properties of Intl.NumberFormat
+ * @description Tests the internal properties of Intl.Collator.
*/
-var testcase = function() {
- "use strict";
+var defaultLocale = new Intl.Collator([]).resolvedOptions().locale;
+var supportedLocales = Intl.Collator.supportedLocalesOf([defaultLocale]);
- var defaultLocale = (new Intl.LocaleList())[0];
- var supportedLocales = Intl.Collator.supportedLocalesOf([defaultLocale]);
-
- if (supportedLocales.length < 1 || supportedLocales[0] != defaultLocale) {
- $ERROR('The default Locale is not supported by Intl.Collator');
- }
+if (supportedLocales.length < 1 || supportedLocales[0] !== defaultLocale) {
+ $ERROR('The default locale is not supported by Intl.Collator');
+}
- // FIXME: Find a way to check that [[relevantExtensionKeys]] === ['nu']
+// FIXME: Find a way to check [[relevantExtensionKeys]]
- // FIXME: Find a way to check specified properties of [[localeData]]
+// FIXME: Find a way to check specified properties of [[localeData]]
- return true;
-}
-runTestCase(testcase);
diff --git a/test/suite/intl402/ch11/11.2/11.2.js b/test/suite/intl402/ch11/11.2/11.2.js
index a79f75af3..2a9c073e9 100644
--- a/test/suite/intl402/ch11/11.2/11.2.js
+++ b/test/suite/intl402/ch11/11.2/11.2.js
@@ -2,22 +2,15 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch11/11.2/11.2.js
* @description Tests that the Intl.Collator constructor has a length
* property that equals 2.
*/
-var testcase = function() {
- "use strict";
-
- if (!Intl.Collator.hasOwnProperty('length')) {
+if (!Intl.Collator.hasOwnProperty('length')) {
$ERROR('Intl.Collator has no length property');
- }
+}
- if (Intl.Collator.length != 2) {
+if (Intl.Collator.length != 2) {
$ERROR('Intl.Collator.length is not 2.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch11/11.3/11.3.1.js b/test/suite/intl402/ch11/11.3/11.3.1.js
index 2ca03c726..699949e18 100644
--- a/test/suite/intl402/ch11/11.3/11.3.1.js
+++ b/test/suite/intl402/ch11/11.3/11.3.1.js
@@ -2,19 +2,12 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch11/11.3/11.3.1.js
* @description Tests that Intl.Collator.prototype.constructor is the
* Intl.Collator.
*/
-var testcase = function() {
- "use strict";
-
- if (Intl.Collator.prototype.constructor !== Intl.Collator) {
+if (Intl.Collator.prototype.constructor !== Intl.Collator) {
$ERROR("Intl.Collator.prototype.constructor is not the same as " +
"Intl.Collator");
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch11/11.3/11.3.js b/test/suite/intl402/ch11/11.3/11.3.js
index 9ea63b92b..aa2e52845 100644
--- a/test/suite/intl402/ch11/11.3/11.3.js
+++ b/test/suite/intl402/ch11/11.3/11.3.js
@@ -2,19 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch11/11.3/11.3.js
- * @description Tests that Intl.Collator.prototype is an intance of
- * Intl.Collator.
+ * @description Tests that Intl.Collator.prototype is an object that
+ * has been initialized as an Intl.Collator.
*/
-var testcase = function() {
- "use strict";
-
- if (!(Intl.Collator.prototype instanceof Intl.Collator)) {
- $ERROR("Intl.Collator's prototype is not an instance of " +
- "Intl.Collator");
- }
-
- return true;
+// test by calling a function that would fail if "this" were not an object
+// initialized as an Intl.Collator
+if (Intl.Collator.prototype.compare("aаあ아", "aаあ아") !== 0) {
+ $ERROR("Intl.Collator.prototype is not an object that has been " +
+ "initialized as an Intl.Collator.");
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.2/12.2.1.js b/test/suite/intl402/ch12/12.2/12.2.1.js
index f4bf51811..0ff91067a 100644
--- a/test/suite/intl402/ch12/12.2/12.2.1.js
+++ b/test/suite/intl402/ch12/12.2/12.2.1.js
@@ -2,32 +2,25 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.2/12.2.1.js
* @description Tests that the Intl.NumberFormat prototype object exists and
* is not writable, enumerable, or configurable.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
+var desc;
- var desc;
-
- if (!Intl.NumberFormat.hasOwnProperty('prototype')) {
+if (!Intl.NumberFormat.hasOwnProperty('prototype')) {
$ERROR('Intl.NumberFormat has no prototype property');
- }
+}
- desc = Object.getOwnPropertyDescriptor(Intl.NumberFormat, 'prototype');
- if (desc.writable === true) {
+desc = Object.getOwnPropertyDescriptor(Intl.NumberFormat, 'prototype');
+if (desc.writable === true) {
$ERROR('Intl.NumberFormat.prototype is writable.');
- }
- if (desc.enumerable === true) {
+}
+if (desc.enumerable === true) {
$ERROR('Intl.NumberFormat.prototype is enumerable.');
- }
- if (desc.configurable === true) {
+}
+if (desc.configurable === true) {
$ERROR('Intl.NumberFormat.prototype is configurable.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.2/12.2.2.js b/test/suite/intl402/ch12/12.2/12.2.2.js
index d16ecdceb..c6c9f9a46 100644
--- a/test/suite/intl402/ch12/12.2/12.2.2.js
+++ b/test/suite/intl402/ch12/12.2/12.2.2.js
@@ -2,34 +2,27 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.2/12.2.2.js
- * @description Tests that the Intl.NumberFormat has a supportedLocalesOf
+ * @description Tests that Intl.NumberFormat has a supportedLocalesOf
* property, and it works as planned.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- var supported = (new Intl.LocaleList())[0];
- var notSupported = 'zxx';
- var requestedLocales = [supported, notSupported];
+var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
+var notSupported = 'zxx'; // "no linguistic content"
+var requestedLocales = [defaultLocale, notSupported];
- var supportedLocales;
+var supportedLocales;
- if (!Intl.NumberFormat.hasOwnProperty('supportedLocalesOf')) {
+if (!Intl.NumberFormat.hasOwnProperty('supportedLocalesOf')) {
$ERROR("Intl.NumberFormat doesn't have a supportedLocalesOf property.");
- }
+}
- supportedLocales = Intl.NumberFormat.supportedLocalesOf(requestedLocales);
- if (supportedLocales.length !== 1) {
+supportedLocales = Intl.NumberFormat.supportedLocalesOf(requestedLocales);
+if (supportedLocales.length !== 1) {
$ERROR('The length of supported locales list is not 1.');
- }
-
- if (supportedLocales[0] !== supported) {
- $ERROR('The supported locale is not returned in the supported list.');
- }
+}
- return true;
+if (supportedLocales[0] !== defaultLocale) {
+ $ERROR('The default locale is not returned in the supported list.');
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.2/12.2.3.js b/test/suite/intl402/ch12/12.2/12.2.3.js
index 743353c52..b0f30e495 100644
--- a/test/suite/intl402/ch12/12.2/12.2.3.js
+++ b/test/suite/intl402/ch12/12.2/12.2.3.js
@@ -2,25 +2,18 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.2/12.2.3.js
- * @description Tests the internal properties of Intl.NumberFormat
+ * @description Tests the internal properties of Intl.NumberFormat.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- var defaultLocale = (new Intl.LocaleList())[0];
- var supportedLocales = Intl.NumberFormat.supportedLocalesOf([defaultLocale]);
+var defaultLocale = new Intl.NumberFormat([]).resolvedOptions().locale;
+var supportedLocales = Intl.NumberFormat.supportedLocalesOf([defaultLocale]);
- if (supportedLocales.length < 1 || supportedLocales[0] != defaultLocale) {
- $ERROR('The default Locale is not supported by Intl.NumberFormat');
- }
+if (supportedLocales.length < 1 || supportedLocales[0] !== defaultLocale) {
+ $ERROR('The default locale is not supported by Intl.NumberFormat');
+}
- // FIXME: Find a way to check that [[relevantExtensionKeys]] === ['nu']
-
- // FIXME: Find a way to check specified properties of [[localeData]]
+// FIXME: Find a way to check that [[relevantExtensionKeys]] === ['nu']
- return true;
-}
-runTestCase(testcase);
+// FIXME: Find a way to check specified properties of [[localeData]]
+
diff --git a/test/suite/intl402/ch12/12.2/12.2.js b/test/suite/intl402/ch12/12.2/12.2.js
index 92c40c656..8094d3bd1 100644
--- a/test/suite/intl402/ch12/12.2/12.2.js
+++ b/test/suite/intl402/ch12/12.2/12.2.js
@@ -2,23 +2,16 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.2/12.2.js
* @description Tests that the Intl.NumberFormat constructor has a length
* property that equals 2.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- if (!Intl.NumberFormat.hasOwnProperty('length')) {
+if (!Intl.NumberFormat.hasOwnProperty('length')) {
$ERROR('Intl.NumberFormat has no length property');
- }
+}
- if (Intl.NumberFormat.length != 2) {
+if (Intl.NumberFormat.length != 2) {
$ERROR('Intl.NumberFormat.length is not 2.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.3/12.3.1.js b/test/suite/intl402/ch12/12.3/12.3.1.js
index a00c2df53..46c7fc519 100644
--- a/test/suite/intl402/ch12/12.3/12.3.1.js
+++ b/test/suite/intl402/ch12/12.3/12.3.1.js
@@ -2,20 +2,13 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.3/12.3.1.js
* @description Tests that Intl.NumberFormat.prototype.constructor is the
* Intl.NumberFormat.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- if (Intl.NumberFormat.prototype.constructor !== Intl.NumberFormat) {
- $ERROR("Intl.NumberFormat.prototype.constructor is not the same as "
- +"Intl.NumberFormat");
- }
-
- return true;
+if (Intl.NumberFormat.prototype.constructor !== Intl.NumberFormat) {
+ $ERROR("Intl.NumberFormat.prototype.constructor is not the same as " +
+ "Intl.NumberFormat");
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_2.js b/test/suite/intl402/ch12/12.3/12.3.2_2.js
index 09fafe15d..bcf4cffff 100644
--- a/test/suite/intl402/ch12/12.3/12.3.2_2.js
+++ b/test/suite/intl402/ch12/12.3/12.3.2_2.js
@@ -2,33 +2,26 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.3/12.3.2_2.js
* @description Tests that Intl.NumberFormat.prototype.format
* converts other types to numbers.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
+var formatter = new Intl.NumberFormat();
+var testData = [undefined, null, true, '0.6666666'];
+var number;
+var i, input, correctResult, result;
- var formatter = new Intl.NumberFormat();
- var testData = [undefined, null, true, '0.6666666'];
- var number;
- var i, input, correctResult, result;
-
- for (i in testData) {
+for (i in testData) {
input = testData[i];
number = +input;
correctResult = formatter.format(number);
result = formatter.format(input);
if (result !== correctResult) {
- $ERROR('Intl.NumberFormat does not convert other ' +
- 'types to numbers. Input: "'+input+'" Output: "'+result+'" '+
- 'Expected output: "'+correctResult+'"');
+ $ERROR('Intl.NumberFormat does not convert other ' +
+ 'types to numbers. Input: "'+input+'" Output: "'+result+'" '+
+ 'Expected output: "'+correctResult+'"');
}
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_3.js b/test/suite/intl402/ch12/12.3/12.3.2_3.js
index 21fc256fe..5f14e7772 100644
--- a/test/suite/intl402/ch12/12.3/12.3.2_3.js
+++ b/test/suite/intl402/ch12/12.3/12.3.2_3.js
@@ -2,25 +2,18 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.3/12.3.2_3.js
* @description Tests that Intl.NumberFormat.prototype.format
* doesn't treat all numbers as negative.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- var formatter = new Intl.NumberFormat();
+var formatter = new Intl.NumberFormat();
- if (formatter.format(1) === formatter.format(-1)) {
+if (formatter.format(1) === formatter.format(-1)) {
$ERROR('Intl.NumberFormat is formatting 1 and -1 the same way.');
- }
+}
- if (formatter.format(-0) !== formatter.format(0)) {
+if (formatter.format(-0) !== formatter.format(0)) {
$ERROR('Intl.NumberFormat is formatting signed zeros differently.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_4.js b/test/suite/intl402/ch12/12.3/12.3.2_4.js
index c3dae9600..ec11a679d 100644
--- a/test/suite/intl402/ch12/12.3/12.3.2_4.js
+++ b/test/suite/intl402/ch12/12.3/12.3.2_4.js
@@ -2,19 +2,15 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.3/12.3.2_4.js
* @description Tests that Intl.NumberFormat.prototype.format
- * hangles NaN, Infinity, and -Infinity properly.
+ * handles NaN, Infinity, and -Infinity properly.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- // FIXME: We are only listing Numeric_Type=Decimal. May need to add more
- // when the spec clarifies. Current as of Unicode 6.1.
- var hasUnicodeDigits = new RegExp('.*([' +
- '\u0030-\u0039\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F' +
+// FIXME: We are only listing Numeric_Type=Decimal. May need to add more
+// when the spec clarifies. Current as of Unicode 6.1.
+var hasUnicodeDigits = new RegExp('.*([' +
+ '0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F' +
'\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF' +
'\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9' +
'\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819' +
@@ -27,40 +23,37 @@ var testcase = function() {
'\uD805[\uDEC0-\uDEC9]|' +
'\uD835[\uDFCE-\uDFFF])');
- var formatter = new Intl.NumberFormat();
- var formattedNaN = formatter.format(NaN);
- var formattedInfinity = formatter.format(Infinity);
- var formattedNegativeInfinity = formatter.format(-Infinity);
+var formatter = new Intl.NumberFormat();
+var formattedNaN = formatter.format(NaN);
+var formattedInfinity = formatter.format(Infinity);
+var formattedNegativeInfinity = formatter.format(-Infinity);
- if (formattedNaN === formattedInfinity) {
+if (formattedNaN === formattedInfinity) {
$ERROR('Intl.NumberFormat formats NaN and Infinity the ' +
'same way.');
- }
+}
- if (formattedNaN === formattedNegativeInfinity) {
+if (formattedNaN === formattedNegativeInfinity) {
$ERROR('Intl.NumberFormat formats NaN and negative ' +
'Infinity the same way.');
- }
+}
- if (formattedInfinity === formattedNegativeInfinity) {
+if (formattedInfinity === formattedNegativeInfinity) {
$ERROR('Intl.NumberFormat formats Infinity and ' +
- 'negaive Infinity the same way.');
- }
+ 'negative Infinity the same way.');
+}
- if (hasUnicodeDigits.test(formattedNaN)) {
+if (hasUnicodeDigits.test(formattedNaN)) {
$ERROR('Intl.NumberFormat formats NaN using a digit.');
- }
+}
- if (hasUnicodeDigits.test(formattedInfinity)) {
+if (hasUnicodeDigits.test(formattedInfinity)) {
$ERROR('Intl.NumberFormat formats Infinity using a ' +
'digit.');
- }
+}
- if (hasUnicodeDigits.test(formattedNegativeInfinity)) {
+if (hasUnicodeDigits.test(formattedNegativeInfinity)) {
$ERROR('Intl.NumberFormat formats negative Infinity ' +
'using a digit.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_5_b.js b/test/suite/intl402/ch12/12.3/12.3.2_5_b.js
index 94a900d56..efe15575d 100644
--- a/test/suite/intl402/ch12/12.3/12.3.2_5_b.js
+++ b/test/suite/intl402/ch12/12.3/12.3.2_5_b.js
@@ -2,33 +2,26 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.3/12.3.2_5_b.js
* @description Tests that Intl.NumberFormat.prototype.format
* formats percent values properly.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
+var numberFormatter = new Intl.NumberFormat();
+var percentFormatter = new Intl.NumberFormat(undefined, {style: 'percent'});
- var numberFormatter = new Intl.NumberFormat();
- var percentFormatter = new Intl.NumberFormat(undefined, {style: 'percent'});
+var formattedTwenty = numberFormatter.format(20);
+var formattedTwentyPercent = percentFormatter.format(0.20);
- var formattedTwenty = numberFormatter.format(20);
- var formattedTwentyPercent = percentFormatter.format(0.20);
-
- // FIXME: May not work for some theoretical locales where percents and
- // normal numbers are formatted using different numbering systems.
- if (formattedTwentyPercent.indexOf(formattedTwenty) === -1) {
+// FIXME: May not work for some theoretical locales where percents and
+// normal numbers are formatted using different numbering systems.
+if (formattedTwentyPercent.indexOf(formattedTwenty) === -1) {
$ERROR("Intl.NumberFormat's formatting of 20% does not include a " +
"formatting of 20 as a substring.");
- }
+}
- // FIXME: Move this to somewhere appropriate
- if (percentFormatter.format(0.011) === percentFormatter.format(0.02)) {
+// FIXME: Move this to somewhere appropriate
+if (percentFormatter.format(0.011) === percentFormatter.format(0.02)) {
$ERROR('Intl.NumberFormat is formatting 1.1% and 2% the same way.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch12/12.3/12.3.2_5_e.js b/test/suite/intl402/ch12/12.3/12.3.2_5_e.js
index 4d23bd1a9..234ae6325 100644
--- a/test/suite/intl402/ch12/12.3/12.3.2_5_e.js
+++ b/test/suite/intl402/ch12/12.3/12.3.2_5_e.js
@@ -2,16 +2,12 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.3/12.3.2_5_e.js
* @description Tests that Intl.NumberFormat.prototype.format
* supports all alternative numbering systems.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- var numberingSystems = {
+var numberingSystems = {
arab: 0x0660,
arabext: 0x06F0,
beng: 0x09E6,
@@ -33,22 +29,19 @@ var testcase = function() {
telu: 0x0C66,
thai: 0x0E50,
tibt: 0x0F20
- };
+};
- var options, formatter;
- var s, zeroCode, digitList;
+var options, formatter;
+var s, zeroCode, digitList;
- for (s in numberingSystems) {
+for (s in numberingSystems) {
zeroCode = numberingSystems[s];
if (typeof zeroCode === 'number') {
- digitList = [zeroCode, zeroCode+1, zeroCode+2, zeroCode+3, zeroCode+4,
+ digitList = [zeroCode, zeroCode+1, zeroCode+2, zeroCode+3, zeroCode+4,
zeroCode+5, zeroCode+6, zeroCode+7, zeroCode+8, zeroCode+9];
- numberingSystems[s] = digitList;
+ numberingSystems[s] = digitList;
}
- }
+}
- // FIXME: Unfinished
+// FIXME: Unfinished
- return true;
-}
-runTestCase(testcase);
diff --git a/test/suite/intl402/ch12/12.3/12.3.js b/test/suite/intl402/ch12/12.3/12.3.js
index 7327197bf..282a10bf6 100644
--- a/test/suite/intl402/ch12/12.3/12.3.js
+++ b/test/suite/intl402/ch12/12.3/12.3.js
@@ -2,20 +2,15 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch12/12.3/12.3.js
- * @description Tests that Intl.NumberFormat.prototype is an intance of
- * Intl.NumberFormat.
+ * @description Tests that Intl.NumberFormat.prototype is an object that
+ * has been initialized as an Intl.NumberFormat.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- if (!(Intl.NumberFormat.prototype instanceof Intl.NumberFormat)) {
- $ERROR("Intl.NumberFormat's prototype is not an instance of " +
- "Intl.NumberFormat");
- }
-
- return true;
+// test by calling a function that would fail if "this" were not an object
+// initialized as an Intl.NumberFormat
+if (typeof Intl.NumberFormat.prototype.format(0) !== "string") {
+ $ERROR("Intl.NumberFormat's prototype is not an object that has been " +
+ "initialized as an Intl.NumberFormat");
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch13/13.2/13.2.1.js b/test/suite/intl402/ch13/13.2/13.2.1.js
index c5a7b1967..4ec28c5d3 100644
--- a/test/suite/intl402/ch13/13.2/13.2.1.js
+++ b/test/suite/intl402/ch13/13.2/13.2.1.js
@@ -2,32 +2,25 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch13/13.2/13.2.1.js
* @description Tests that the Intl.DateTimeFormat prototype object exists and
* is not writable, enumerable, or configurable.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
+var desc;
- var desc;
-
- if (!Intl.DateTimeFormat.hasOwnProperty('prototype')) {
+if (!Intl.DateTimeFormat.hasOwnProperty('prototype')) {
$ERROR('Intl.DateTimeFormat has no prototype property');
- }
+}
- desc = Object.getOwnPropertyDescriptor(Intl.DateTimeFormat, 'prototype');
- if (desc.writable === true) {
+desc = Object.getOwnPropertyDescriptor(Intl.DateTimeFormat, 'prototype');
+if (desc.writable === true) {
$ERROR('Intl.DateTimeFormat.prototype is writable.');
- }
- if (desc.enumerable === true) {
+}
+if (desc.enumerable === true) {
$ERROR('Intl.DateTimeFormat.prototype is enumerable.');
- }
- if (desc.configurable === true) {
+}
+if (desc.configurable === true) {
$ERROR('Intl.DateTimeFormat.prototype is configurable.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch13/13.2/13.2.2.js b/test/suite/intl402/ch13/13.2/13.2.2.js
index 9bcfa54f6..42eedc0a1 100644
--- a/test/suite/intl402/ch13/13.2/13.2.2.js
+++ b/test/suite/intl402/ch13/13.2/13.2.2.js
@@ -2,34 +2,27 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch13/13.2/13.2.2.js
- * @description Tests that the Intl.DateTimeFormat has a supportedLocalesOf
+ * @description Tests that Intl.DateTimeFormat has a supportedLocalesOf
* property, and it works as planned.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- var supported = (new Intl.LocaleList())[0];
- var notSupported = 'zxx';
- var requestedLocales = [supported, notSupported];
+var defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale;
+var notSupported = 'zxx'; // "no linguistic content"
+var requestedLocales = [defaultLocale, notSupported];
- var supportedLocales;
+var supportedLocales;
- if (!Intl.DateTimeFormat.hasOwnProperty('supportedLocalesOf')) {
+if (!Intl.DateTimeFormat.hasOwnProperty('supportedLocalesOf')) {
$ERROR("Intl.DateTimeFormat doesn't have a supportedLocalesOf property.");
- }
+}
- supportedLocales = Intl.DateTimeFormat.supportedLocalesOf(requestedLocales);
- if (supportedLocales.length !== 1) {
+supportedLocales = Intl.DateTimeFormat.supportedLocalesOf(requestedLocales);
+if (supportedLocales.length !== 1) {
$ERROR('The length of supported locales list is not 1.');
- }
-
- if (supportedLocales[0] !== supported) {
- $ERROR('The supported locale is not returned in the supported list.');
- }
+}
- return true;
+if (supportedLocales[0] !== defaultLocale) {
+ $ERROR('The default locale is not returned in the supported list.');
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch13/13.2/13.2.3.js b/test/suite/intl402/ch13/13.2/13.2.3.js
index 56f9eadf5..333d97ae8 100644
--- a/test/suite/intl402/ch13/13.2/13.2.3.js
+++ b/test/suite/intl402/ch13/13.2/13.2.3.js
@@ -2,25 +2,18 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch13/13.2/13.2.3.js
- * @description Tests the internal properties of Intl.DateTimeFormat
+ * @description Tests the internal properties of Intl.DateTimeFormat.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- var defaultLocale = (new Intl.LocaleList())[0];
- var supportedLocales = Intl.DateTimeFormat.supportedLocalesOf([defaultLocale]);
+var defaultLocale = new Intl.DateTimeFormat([]).resolvedOptions().locale;
+var supportedLocales = Intl.DateTimeFormat.supportedLocalesOf([defaultLocale]);
- if (supportedLocales.length < 1 || supportedLocales[0] != defaultLocale) {
- $ERROR('The default Locale is not supported by Intl.DateTimeFormat');
- }
+if (supportedLocales.length < 1 || supportedLocales[0] !== defaultLocale) {
+ $ERROR('The default locale is not supported by Intl.DateTimeFormat');
+}
- // FIXME: Find a way to check that [[relevantExtensionKeys]] === ['ca', 'nu']
-
- // FIXME: Find a way to check specified properties of [[localeData]]
+// FIXME: Find a way to check that [[relevantExtensionKeys]] === ['ca', 'nu']
- return true;
-}
-runTestCase(testcase);
+// FIXME: Find a way to check specified properties of [[localeData]]
+
diff --git a/test/suite/intl402/ch13/13.2/13.2.js b/test/suite/intl402/ch13/13.2/13.2.js
index e58ac5dc4..59785479a 100644
--- a/test/suite/intl402/ch13/13.2/13.2.js
+++ b/test/suite/intl402/ch13/13.2/13.2.js
@@ -2,23 +2,16 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch13/13.2/13.2.js
* @description Tests that the Intl.DateTimeFormat constructor has a length
* property that equals 2.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- if (!Intl.DateTimeFormat.hasOwnProperty('length')) {
+if (!Intl.DateTimeFormat.hasOwnProperty('length')) {
$ERROR('Intl.DateTimeFormat has no length property');
- }
+}
- if (Intl.DateTimeFormat.length != 2) {
+if (Intl.DateTimeFormat.length != 2) {
$ERROR('Intl.DateTimeFormat.length is not 2.');
- }
-
- return true;
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch13/13.3/13.3.1.js b/test/suite/intl402/ch13/13.3/13.3.1.js
index 8ce7b92b9..1755dd64b 100644
--- a/test/suite/intl402/ch13/13.3/13.3.1.js
+++ b/test/suite/intl402/ch13/13.3/13.3.1.js
@@ -2,20 +2,13 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch13/13.3/13.3.1.js
* @description Tests that Intl.DateTimeFormat.prototype.constructor is the
* Intl.DateTimeFormat.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- if (Intl.DateTimeFormat.prototype.constructor !== Intl.DateTimeFormat) {
- $ERROR("Intl.DateTimeFormat.prototype.constructor is not the same as "
- +"Intl.DateTimeFormat");
- }
-
- return true;
+if (Intl.DateTimeFormat.prototype.constructor !== Intl.DateTimeFormat) {
+ $ERROR("Intl.DateTimeFormat.prototype.constructor is not the same as " +
+ "Intl.DateTimeFormat");
}
-runTestCase(testcase);
+
diff --git a/test/suite/intl402/ch13/13.3/13.3.js b/test/suite/intl402/ch13/13.3/13.3.js
index bb33a2037..e1d795b91 100644
--- a/test/suite/intl402/ch13/13.3/13.3.js
+++ b/test/suite/intl402/ch13/13.3/13.3.js
@@ -2,20 +2,15 @@
// This code is governed by the BSD license found in the LICENSE file.
/**
- * @path intl402/ch13/13.3/13.3.js
- * @description Tests that Intl.DateTimeFormat.prototype is an intance of
- * Intl.DateTimeFormat.
+ * @description Tests that Intl.DateTimeFormat.prototype is an object that
+ * has been initialized as an Intl.DateTimeFormat.
* @author: Roozbeh Pournader
*/
-var testcase = function() {
- "use strict";
-
- if (!(Intl.DateTimeFormat.prototype instanceof Intl.DateTimeFormat)) {
- $ERROR("Intl.DateTimeFormat's prototype is not an instance of " +
- "Intl.DateTimeFormat");
- }
-
- return true;
+// test by calling a function that would fail if "this" were not an object
+// initialized as an Intl.DateTimeFormat
+if (typeof Intl.DateTimeFormat.prototype.format(0) !== "string") {
+ $ERROR("Intl.DateTimeFormat's prototype is not an object that has been " +
+ "initialized as an Intl.DateTimeFormat");
}
-runTestCase(testcase);
+