Initial intl402 checkin.

This commit is contained in:
Nebojsa Ciric 2012-04-16 13:23:13 -07:00
parent 1087776d49
commit cc9f5eab48
59 changed files with 1011 additions and 26 deletions

View File

@ -0,0 +1,49 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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;
}
runTestCase(testcase);

View File

@ -0,0 +1,38 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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.')
}
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);

View File

@ -0,0 +1,23 @@
// 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

@ -0,0 +1,23 @@
// 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

@ -0,0 +1,23 @@
// 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

@ -0,0 +1,23 @@
// 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

@ -0,0 +1,30 @@
// 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

@ -0,0 +1,28 @@
// 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

@ -0,0 +1,30 @@
// 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

@ -0,0 +1,30 @@
// 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

@ -0,0 +1,32 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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')) {
$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);

View File

@ -0,0 +1,34 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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
* 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 supportedLocales;
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);

View File

@ -0,0 +1,25 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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
*/
var testcase = function() {
"use strict";
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;
}
runTestCase(testcase);

View File

@ -0,0 +1,23 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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');
}
if (Intl.Collator.length != 2) {
$ERROR('Intl.Collator.length is not 2.');
}
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,20 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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

@ -0,0 +1,20 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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.
*/
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;
}
runTestCase(testcase);

View File

@ -0,0 +1,33 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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')) {
$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);

View File

@ -0,0 +1,35 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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
* 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 supportedLocales;
if (!Intl.NumberFormat.hasOwnProperty('supportedLocalesOf')) {
$ERROR("Intl.NumberFormat doesn't have a supportedLocalesOf property.");
}
supportedLocales = Intl.NumberFormat.supportedLocalesOf(requestedLocales);
if (supportedLocales.length !== 1) {
$ERROR('The length of supported locales list is not 1.');
}
if (supportedLocales[0] !== supported) {
$ERROR('The supported locale is not returned in the supported list.');
}
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,26 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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
* @author: Roozbeh Pournader
*/
var testcase = function() {
"use strict";
var defaultLocale = (new Intl.LocaleList())[0];
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;
}
runTestCase(testcase);

View File

@ -0,0 +1,24 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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');
}
if (Intl.NumberFormat.length != 2) {
$ERROR('Intl.NumberFormat.length is not 2.');
}
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,21 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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;
}
runTestCase(testcase);

View File

@ -0,0 +1,34 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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;
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+'"');
}
}
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,26 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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)) {
$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);

View File

@ -0,0 +1,66 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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.
* @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' +
'\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' +
'\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59' +
'\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9' +
'\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19' +
']|' +
'\uD801[\uDCA0-\uDCA9]|' +
'\uD804[\uDC66-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9]|' +
'\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);
if (formattedNaN === formattedInfinity) {
$ERROR('Intl.NumberFormat formats NaN and Infinity the ' +
'same way.');
}
if (formattedNaN === formattedNegativeInfinity) {
$ERROR('Intl.NumberFormat formats NaN and negative ' +
'Infinity the same way.');
}
if (formattedInfinity === formattedNegativeInfinity) {
$ERROR('Intl.NumberFormat formats Infinity and ' +
'negaive Infinity the same way.');
}
if (hasUnicodeDigits.test(formattedNaN)) {
$ERROR('Intl.NumberFormat formats NaN using a digit.');
}
if (hasUnicodeDigits.test(formattedInfinity)) {
$ERROR('Intl.NumberFormat formats Infinity using a ' +
'digit.');
}
if (hasUnicodeDigits.test(formattedNegativeInfinity)) {
$ERROR('Intl.NumberFormat formats negative Infinity ' +
'using a digit.');
}
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,34 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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 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) {
$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);

View File

@ -0,0 +1,54 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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,
beng: 0x09E6,
deva: 0x0966,
fullwide: 0xFF10,
gujr: 0x0AE6,
guru: 0x0A66,
hanidec: [0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB,
0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D],
khmr: 0x17E0,
knda: 0x0CE6,
laoo: 0x0ED0,
latn: 0x0030,
mlym: 0x0D66,
mong: 0x1810,
mymr: 0x1040,
orya: 0x0B66,
tamldec: 0x0BE6,
telu: 0x0C66,
thai: 0x0E50,
tibt: 0x0F20
};
var options, formatter;
var s, zeroCode, digitList;
for (s in numberingSystems) {
zeroCode = numberingSystems[s];
if (typeof zeroCode === 'number') {
digitList = [zeroCode, zeroCode+1, zeroCode+2, zeroCode+3, zeroCode+4,
zeroCode+5, zeroCode+6, zeroCode+7, zeroCode+8, zeroCode+9];
numberingSystems[s] = digitList;
}
}
// FIXME: Unfinished
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,21 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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.
* @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;
}
runTestCase(testcase);

View File

@ -0,0 +1,33 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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')) {
$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);

View File

@ -0,0 +1,35 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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
* 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 supportedLocales;
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);

View File

@ -0,0 +1,26 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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
* @author: Roozbeh Pournader
*/
var testcase = function() {
"use strict";
var defaultLocale = (new Intl.LocaleList())[0];
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;
}
runTestCase(testcase);

View File

@ -0,0 +1,24 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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');
}
if (Intl.DateTimeFormat.length != 2) {
$ERROR('Intl.DateTimeFormat.length is not 2.');
}
return true;
}
runTestCase(testcase);

View File

@ -0,0 +1,21 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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;
}
runTestCase(testcase);

View File

@ -0,0 +1,21 @@
// Copyright 2012 Google Inc. All rights reserved.
// 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.
* @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;
}
runTestCase(testcase);

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/default.json";
var TEST_LIST_PATH = "json/default.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"numTests":11563,"testSuite":["json/ch07.json","json/ch08.json","json/ch09.json","json/ch10.json","json/ch11.json","json/ch12.json","json/ch13.json","json/ch14.json","json/ch15.json"]}
{"numTests":11563,"testSuite":["json/ch11.json","json/ch13.json","json/ch14.json","json/ch07.json","json/ch08.json","json/ch10.json","json/ch15.json","json/ch12.json","json/ch09.json"]}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"date":"2012-03-28","version":"ES5.1"}
{"date":"2012-04-16","version":"ES5.1"}

View File

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

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_bestPractice.json";
var TEST_LIST_PATH = "json/testcases_bestPractice.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch07.json";
var TEST_LIST_PATH = "json/testcases_ch07.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch08.json";
var TEST_LIST_PATH = "json/testcases_ch08.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch09.json";
var TEST_LIST_PATH = "json/testcases_ch09.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch10.json";
var TEST_LIST_PATH = "json/testcases_ch10.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch11.json";
var TEST_LIST_PATH = "json/testcases_ch11.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch12.json";
var TEST_LIST_PATH = "json/testcases_ch12.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch13.json";
var TEST_LIST_PATH = "json/testcases_ch13.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch14.json";
var TEST_LIST_PATH = "json/testcases_ch14.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_ch15.json";
var TEST_LIST_PATH = "json/testcases_ch15.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="harness/sections.js"></script>
<script type="text/javascript">
//Globals
var TEST_LIST_PATH = "json/testcases_intl402.json";
var TEST_LIST_PATH = "json/testcases_intl402.json";
</script>
<script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script>