mirror of https://github.com/tc39/test262.git
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:
parent
9f4a513496
commit
c3111850e3
|
@ -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);
|
|
@ -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.')
|
||||
}
|
||||
|
||||
if (Object.isExtensible(Intl) === false) {
|
||||
$ERROR('isExtensible(Intl) returns false.')
|
||||
}
|
||||
|
||||
var falsey = undefined;
|
||||
|
||||
// Intl can't be constructed.
|
||||
try {
|
||||
falsey = new Intl();
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
if (!!falsey) {
|
||||
$ERROR('Intl object should not be constructable.')
|
||||
}
|
||||
|
||||
// Intl can't be called as a function.
|
||||
try {
|
||||
falsey = Intl();
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
if (!!falsey) {
|
||||
$ERROR('Intl should not be callable.')
|
||||
}
|
||||
|
||||
passed = true;
|
||||
|
||||
return passed;
|
||||
// We keep Intl extensible and not frozen.
|
||||
if (Object.isFrozen(Intl) === true) {
|
||||
$ERROR('isFrozen(Intl) returns true.');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
if (Object.isExtensible(Intl) === false) {
|
||||
$ERROR('isExtensible(Intl) returns false.');
|
||||
}
|
||||
|
||||
var falsey;
|
||||
|
||||
// Intl can't be constructed.
|
||||
try {
|
||||
falsey = new Intl();
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
if (!!falsey) {
|
||||
$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.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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.DateTimeFormat !== 'function') {
|
||||
$ERROR('Intl.DateTimeFormat is not a function.')
|
||||
}
|
||||
|
||||
passed = true;
|
||||
|
||||
return passed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
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.DateTimeFormat !== 'function') {
|
||||
$ERROR('Intl.DateTimeFormat is not a function.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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);
|
|
@ -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) {
|
||||
$ERROR('Intl.Collator.prototype is writable.');
|
||||
}
|
||||
if (desc.enumerable === true) {
|
||||
$ERROR('Intl.Collator.prototype is enumerable.');
|
||||
}
|
||||
if (desc.configurable === true) {
|
||||
$ERROR('Intl.Collator.prototype is configurable.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(Intl.Collator, 'prototype');
|
||||
if (desc.writable === true) {
|
||||
$ERROR('Intl.Collator.prototype is writable.');
|
||||
}
|
||||
if (desc.enumerable === true) {
|
||||
$ERROR('Intl.Collator.prototype is enumerable.');
|
||||
}
|
||||
if (desc.configurable === true) {
|
||||
$ERROR('Intl.Collator.prototype is configurable.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$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;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
supportedLocales = Intl.Collator.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.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
// FIXME: Find a way to check that [[relevantExtensionKeys]] === ['nu']
|
||||
|
||||
// FIXME: Find a way to check specified properties of [[localeData]]
|
||||
|
||||
return true;
|
||||
if (supportedLocales.length < 1 || supportedLocales[0] !== defaultLocale) {
|
||||
$ERROR('The default locale is not supported by Intl.Collator');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
// FIXME: Find a way to check [[relevantExtensionKeys]]
|
||||
|
||||
// FIXME: Find a way to check specified properties of [[localeData]]
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$ERROR('Intl.Collator.length is not 2.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
if (Intl.Collator.length != 2) {
|
||||
$ERROR('Intl.Collator.length is not 2.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$ERROR('Intl.NumberFormat.prototype is writable.');
|
||||
}
|
||||
if (desc.enumerable === true) {
|
||||
$ERROR('Intl.NumberFormat.prototype is enumerable.');
|
||||
}
|
||||
if (desc.configurable === true) {
|
||||
$ERROR('Intl.NumberFormat.prototype is configurable.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(Intl.NumberFormat, 'prototype');
|
||||
if (desc.writable === true) {
|
||||
$ERROR('Intl.NumberFormat.prototype is writable.');
|
||||
}
|
||||
if (desc.enumerable === true) {
|
||||
$ERROR('Intl.NumberFormat.prototype is enumerable.');
|
||||
}
|
||||
if (desc.configurable === true) {
|
||||
$ERROR('Intl.NumberFormat.prototype is configurable.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$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;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
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.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
// FIXME: Find a way to check that [[relevantExtensionKeys]] === ['nu']
|
||||
|
||||
// FIXME: Find a way to check specified properties of [[localeData]]
|
||||
|
||||
return true;
|
||||
if (supportedLocales.length < 1 || supportedLocales[0] !== defaultLocale) {
|
||||
$ERROR('The default locale is not supported by Intl.NumberFormat');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
// FIXME: Find a way to check that [[relevantExtensionKeys]] === ['nu']
|
||||
|
||||
// FIXME: Find a way to check specified properties of [[localeData]]
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$ERROR('Intl.NumberFormat.length is not 2.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
if (Intl.NumberFormat.length != 2) {
|
||||
$ERROR('Intl.NumberFormat.length is not 2.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
$ERROR('Intl.NumberFormat is formatting signed zeros differently.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
if (formatter.format(-0) !== formatter.format(0)) {
|
||||
$ERROR('Intl.NumberFormat is formatting signed zeros differently.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
$ERROR('Intl.NumberFormat is formatting 1.1% and 2% the same way.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
// 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.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
// FIXME: Unfinished
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$ERROR('Intl.DateTimeFormat.prototype is writable.');
|
||||
}
|
||||
if (desc.enumerable === true) {
|
||||
$ERROR('Intl.DateTimeFormat.prototype is enumerable.');
|
||||
}
|
||||
if (desc.configurable === true) {
|
||||
$ERROR('Intl.DateTimeFormat.prototype is configurable.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
desc = Object.getOwnPropertyDescriptor(Intl.DateTimeFormat, 'prototype');
|
||||
if (desc.writable === true) {
|
||||
$ERROR('Intl.DateTimeFormat.prototype is writable.');
|
||||
}
|
||||
if (desc.enumerable === true) {
|
||||
$ERROR('Intl.DateTimeFormat.prototype is enumerable.');
|
||||
}
|
||||
if (desc.configurable === true) {
|
||||
$ERROR('Intl.DateTimeFormat.prototype is configurable.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$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;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
supportedLocales = Intl.DateTimeFormat.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.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
// FIXME: Find a way to check that [[relevantExtensionKeys]] === ['ca', 'nu']
|
||||
|
||||
// FIXME: Find a way to check specified properties of [[localeData]]
|
||||
|
||||
return true;
|
||||
if (supportedLocales.length < 1 || supportedLocales[0] !== defaultLocale) {
|
||||
$ERROR('The default locale is not supported by Intl.DateTimeFormat');
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
// FIXME: Find a way to check that [[relevantExtensionKeys]] === ['ca', 'nu']
|
||||
|
||||
// FIXME: Find a way to check specified properties of [[localeData]]
|
||||
|
||||
|
|
|
@ -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) {
|
||||
$ERROR('Intl.DateTimeFormat.length is not 2.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
if (Intl.DateTimeFormat.length != 2) {
|
||||
$ERROR('Intl.DateTimeFormat.length is not 2.');
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
@ -1 +1 @@
|
|||
{"numTests":34,"testSuite":["json/intl402.json"]}
|
||||
{"numTests":25,"testSuite":["json/intl402.json"]}
|
Loading…
Reference in New Issue