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.
This commit is contained in:
Norbert Lindenberg 2012-08-22 17:53:26 -07:00
parent 9f4a513496
commit c3111850e3
37 changed files with 282 additions and 699 deletions

View File

@ -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);

View File

@ -2,25 +2,19 @@
// 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.')
$ERROR('isFrozen(Intl) returns true.');
}
if (Object.isExtensible(Intl) === false) {
$ERROR('isExtensible(Intl) returns false.')
$ERROR('isExtensible(Intl) returns false.');
}
var falsey = undefined;
var falsey;
// Intl can't be constructed.
try {
@ -29,21 +23,17 @@ function testcase() {
}
if (!!falsey) {
$ERROR('Intl object should not be constructable.')
$ERROR('Intl object should not be constructable.');
}
// Intl can't be called as a function.
try {
/*jshint newcap:false*/
falsey = Intl();
} catch (e) {
}
if (!!falsey) {
$ERROR('Intl should not be callable.')
$ERROR('Intl should not be callable.');
}
passed = true;
return passed;
}
runTestCase(testcase);

View File

@ -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) {
$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.')
$ERROR('Intl.Collator is not a function.');
}
if (typeof Intl.NumberFormat !== 'function') {
$ERROR('Intl.NumberFormat is not a function.')
$ERROR('Intl.NumberFormat is not a function.');
}
if (typeof Intl.DateTimeFormat !== 'function') {
$ERROR('Intl.DateTimeFormat is not a function.')
$ERROR('Intl.DateTimeFormat is not a function.');
}
passed = true;
return passed;
}
runTestCase(testcase);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -2,14 +2,10 @@
// 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;
if (!Intl.Collator.hasOwnProperty('prototype')) {
@ -27,6 +23,3 @@ var testcase = function() {
$ERROR('Intl.Collator.prototype is configurable.');
}
return true;
}
runTestCase(testcase);

View File

@ -2,17 +2,13 @@
// 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 supported = (new Intl.LocaleList())[0];
var notSupported = 'zxx';
var requestedLocales = [supported, notSupported];
var defaultLocale = new Intl.Collator().resolvedOptions().locale;
var notSupported = 'zxx'; // "no linguistic content"
var requestedLocales = [defaultLocale, notSupported];
var supportedLocales;
@ -25,10 +21,7 @@ var testcase = function() {
$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.');
if (supportedLocales[0] !== defaultLocale) {
$ERROR('The default locale is not returned in the supported list.');
}
return true;
}
runTestCase(testcase);

View File

@ -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.LocaleList())[0];
var defaultLocale = new Intl.Collator([]).resolvedOptions().locale;
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]]
return true;
}
runTestCase(testcase);

View File

@ -2,14 +2,10 @@
// 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')) {
$ERROR('Intl.Collator has no length property');
}
@ -18,6 +14,3 @@ var testcase = function() {
$ERROR('Intl.Collator.length is not 2.');
}
return true;
}
runTestCase(testcase);

View File

@ -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) {
$ERROR("Intl.Collator.prototype.constructor is not the same as " +
"Intl.Collator");
}
return true;
}
runTestCase(testcase);

View File

@ -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");
// 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.");
}
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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;
if (!Intl.NumberFormat.hasOwnProperty('prototype')) {
@ -28,6 +24,3 @@ var testcase = function() {
$ERROR('Intl.NumberFormat.prototype is configurable.');
}
return true;
}
runTestCase(testcase);

View File

@ -2,18 +2,14 @@
// 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;
@ -26,10 +22,7 @@ var testcase = function() {
$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.');
if (supportedLocales[0] !== defaultLocale) {
$ERROR('The default locale is not returned in the supported list.');
}
return true;
}
runTestCase(testcase);

View File

@ -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 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]]
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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')) {
$ERROR('Intl.NumberFormat has no length property');
}
@ -19,6 +15,3 @@ var testcase = function() {
$ERROR('Intl.NumberFormat.length is not 2.');
}
return true;
}
runTestCase(testcase);

View File

@ -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");
$ERROR("Intl.NumberFormat.prototype.constructor is not the same as " +
"Intl.NumberFormat");
}
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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;
@ -29,6 +25,3 @@ var testcase = function() {
}
}
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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();
if (formatter.format(1) === formatter.format(-1)) {
@ -21,6 +17,3 @@ var testcase = function() {
$ERROR('Intl.NumberFormat is formatting signed zeros differently.');
}
return true;
}
runTestCase(testcase);

View File

@ -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' +
'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' +
@ -44,7 +40,7 @@ var testcase = function() {
if (formattedInfinity === formattedNegativeInfinity) {
$ERROR('Intl.NumberFormat formats Infinity and ' +
'negaive Infinity the same way.');
'negative Infinity the same way.');
}
if (hasUnicodeDigits.test(formattedNaN)) {
@ -61,6 +57,3 @@ var testcase = function() {
'using a digit.');
}
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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'});
@ -29,6 +25,3 @@ var testcase = function() {
$ERROR('Intl.NumberFormat is formatting 1.1% and 2% the same way.');
}
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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 = {
arab: 0x0660,
arabext: 0x06F0,
@ -49,6 +45,3 @@ var testcase = function() {
// FIXME: Unfinished
return true;
}
runTestCase(testcase);

View File

@ -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");
// 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");
}
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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;
if (!Intl.DateTimeFormat.hasOwnProperty('prototype')) {
@ -28,6 +24,3 @@ var testcase = function() {
$ERROR('Intl.DateTimeFormat.prototype is configurable.');
}
return true;
}
runTestCase(testcase);

View File

@ -2,18 +2,14 @@
// 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;
@ -26,10 +22,7 @@ var testcase = function() {
$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.');
if (supportedLocales[0] !== defaultLocale) {
$ERROR('The default locale is not returned in the supported list.');
}
return true;
}
runTestCase(testcase);

View File

@ -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 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]]
return true;
}
runTestCase(testcase);

View File

@ -2,15 +2,11 @@
// 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')) {
$ERROR('Intl.DateTimeFormat has no length property');
}
@ -19,6 +15,3 @@ var testcase = function() {
$ERROR('Intl.DateTimeFormat.length is not 2.');
}
return true;
}
runTestCase(testcase);

View File

@ -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");
$ERROR("Intl.DateTimeFormat.prototype.constructor is not the same as " +
"Intl.DateTimeFormat");
}
return true;
}
runTestCase(testcase);

View File

@ -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");
// 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");
}
return true;
}
runTestCase(testcase);

View File

@ -238,7 +238,8 @@ for chapter in TEST_SUITE_SECTIONS:
#now get the metadata added.
tempDict = convertDocString("".join(scriptCode))
for tempKey in tempDict.keys():
#TODO - is this check really necessary?
#path is set from the file path above; the "@path" property
#in comments is redundant
if not (tempKey in ["path"]):
testDict[tempKey] = tempDict[tempKey]

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"numTests":34,"testSuite":["json/intl402.json"]}
{"numTests":25,"testSuite":["json/intl402.json"]}