Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit dde2342

Browse files
author
Andy Earnshaw
committed
Pre-setup tests to speed things up in IE 8
1 parent fd787f1 commit dde2342

File tree

107 files changed

+364
-586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+364
-586
lines changed

tasks/update-tests.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ var WRAPPER_START = [
1818
'}',
1919

2020
// Make sure polyfilled ECMA-262 functions are in place for the tests
21-
'IntlPolyfill.__applyLocaleSensitivePrototypes();',
22-
23-
'function runTheTest() {'
21+
'IntlPolyfill.__applyLocaleSensitivePrototypes();'
2422
].join('\n');
2523

2624
var WRAPPER_END = [
27-
'}',
28-
2925
// In the browser, a button will run the following function,
3026
// and we can also call it with the webdriver's execute() function
3127
'function runner() {',
@@ -251,7 +247,7 @@ module.exports = function(grunt) {
251247
var srcPath = LIBS.path.resolve(SRC_DIR, testPath),
252248
destPath = LIBS.path.resolve(DEST_DIR, testPath),
253249
content;
254-
content = grunt.file.read(srcPath);
250+
content = 'function runTheTest () {'+ grunt.file.read(srcPath) +' }';
255251
content = processTest(content);
256252
content = wrapTest(content);
257253
destPath = destPath.replace(/\.js$/, '.html');

tests/test262/pages/11.1.1_1.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
@@ -1223,14 +1222,14 @@
12231222
}
12241223

12251224

1226-
// Copyright 2012 Mozilla Corporation. All rights reserved.
1225+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
12271226
// This code is governed by the BSD license found in the LICENSE file.
12281227

12291228
/*---
12301229
es5id: 11.1.1_1
12311230
description: Tests that an object can't be re-initialized as a NumberFormat.
12321231
author: Norbert Lindenberg
1233-
/Users/caridy/repo/IntlPolyfill.js/tests/test262/harness/testIntl.js
1232+
/Volumes/HOME/Users/andyearnshaw/Development/IntlPolyfill.js/tests/test262/harness/testIntl.js
12341233
---*/
12351234

12361235
testWithIntlConstructors(function (Constructor) {
@@ -1265,8 +1264,7 @@
12651264

12661265
return true;
12671266
});
1268-
1269-
}
1267+
}
12701268
function runner() {
12711269
var passed = false;
12721270
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_15.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
@@ -1223,20 +1222,19 @@
12231222
}
12241223

12251224

1226-
// Copyright 2012 Mozilla Corporation. All rights reserved.
1225+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
12271226
// This code is governed by the BSD license found in the LICENSE file.
12281227

12291228
/*---
12301229
es5id: 11.1.1_15
12311230
description: Tests that the option style is processed correctly.
12321231
author: Norbert Lindenberg
1233-
/Users/caridy/repo/IntlPolyfill.js/tests/test262/harness/testIntl.js
1232+
/Volumes/HOME/Users/andyearnshaw/Development/IntlPolyfill.js/tests/test262/harness/testIntl.js
12341233
---*/
12351234

12361235
testOption(IntlPolyfill.NumberFormat, "style", "string", ["decimal", "percent", "currency"], "decimal",
12371236
{extra: {"currency": {currency: "CNY"}}});
1238-
1239-
}
1237+
}
12401238
function runner() {
12411239
var passed = false;
12421240
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_17.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
Array.prototype.forEach = Array.prototype.forEach || function (fn) {
98
for (var i=0; i < this.length; i++)
109
fn.call(arguments[1], this[i], i, this);
1110
};
1211

13-
// Copyright 2012 Mozilla Corporation. All rights reserved.
12+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
1413
// This code is governed by the BSD license found in the LICENSE file.
1514

1615
/*---
@@ -91,8 +90,7 @@
9190
return new IntlPolyfill.NumberFormat([defaultLocale + "-u-cu-krw"], {currency: value});
9291
});
9392
});
94-
95-
}
93+
}
9694
function runner() {
9795
var passed = false;
9896
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_19.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87

98

10-
// Copyright 2012 Mozilla Corporation. All rights reserved.
9+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
1110
// This code is governed by the BSD license found in the LICENSE file.
1211

1312
/*---
@@ -40,8 +39,7 @@
4039
expectError(function () {
4140
return new IntlPolyfill.NumberFormat([defaultLocale + "-u-cu-krw"], {style: "currency"});
4241
});
43-
44-
}
42+
}
4543
function runner() {
4644
var passed = false;
4745
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_20_c.html

+4-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
Object.getOwnPropertyNames = Object.getOwnPropertyNames || function (obj) {
98
var ret = [];
109

@@ -20,7 +19,7 @@
2019
fn.call(arguments[1], this[i], i, this);
2120
};
2221

23-
// Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
22+
function runTheTest () {// Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
2423
// Copyright 2012 Mozilla Corporation. All rights reserved.
2524
// This code is governed by the BSD license found in the LICENSE file.
2625

@@ -32,7 +31,7 @@
3231
author: Norbert Lindenberg
3332
---*/
3433

35-
// data from http://www.currency-iso.org/dl_iso_table_a1.xml, 2013-02-25
34+
// data from http://www.currency-iso.org/dam/downloads/table_a1.xml, 2015-03-23
3635
var currencyDigits = {
3736
AED: 2,
3837
AFN: 2,
@@ -65,7 +64,7 @@
6564
CHE: 2,
6665
CHF: 2,
6766
CHW: 2,
68-
CLF: 0,
67+
CLF: 4,
6968
CLP: 0,
7069
CNY: 2,
7170
COP: 2,
@@ -121,8 +120,6 @@
121120
LKR: 2,
122121
LRD: 2,
123122
LSL: 2,
124-
LTL: 2,
125-
LVL: 2,
126123
LYD: 3,
127124
MAD: 2,
128125
MDL: 2,
@@ -186,7 +183,6 @@
186183
UGX: 0,
187184
USD: 2,
188185
USN: 2,
189-
USS: 2,
190186
UYI: 0,
191187
UYU: 2,
192188
UZS: 2,
@@ -218,8 +214,7 @@
218214
currency + "; expected " + digits + ", got " + max + ".");
219215
}
220216
});
221-
222-
}
217+
}
223218
function runner() {
224219
var passed = false;
225220
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_21.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
@@ -1223,22 +1222,21 @@
12231222
}
12241223

12251224

1226-
// Copyright 2012 Mozilla Corporation. All rights reserved.
1225+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
12271226
// This code is governed by the BSD license found in the LICENSE file.
12281227

12291228
/*---
12301229
es5id: 11.1.1_21
12311230
description: Tests that the option currencyDisplay is processed correctly.
12321231
author: Norbert Lindenberg
1233-
/Users/caridy/repo/IntlPolyfill.js/tests/test262/harness/testIntl.js
1232+
/Volumes/HOME/Users/andyearnshaw/Development/IntlPolyfill.js/tests/test262/harness/testIntl.js
12341233
---*/
12351234

12361235
testOption(IntlPolyfill.NumberFormat, "currencyDisplay", "string", ["code", "symbol", "name"],
12371236
"symbol", {extra: {any: {style: "currency", currency: "XDR"}}});
12381237
testOption(IntlPolyfill.NumberFormat, "currencyDisplay", "string", ["code", "symbol", "name"],
12391238
undefined, {noReturn: true});
1240-
1241-
}
1239+
}
12421240
function runner() {
12431241
var passed = false;
12441242
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_32.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
1110
} }
1211

13-
// Copyright 2013 Mozilla Corporation. All rights reserved.
12+
function runTheTest () {// Copyright 2013 Mozilla Corporation. All rights reserved.
1413
// This code is governed by the BSD license found in the LICENSE file.
1514

1615
/*---
@@ -56,8 +55,7 @@
5655
if (read !== 4) {
5756
throw new Error("insuffient number of property reads: " + read + ".");
5857
}
59-
60-
}
58+
}
6159
function runner() {
6260
var passed = false;
6361
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_34.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
@@ -1223,19 +1222,18 @@
12231222
}
12241223

12251224

1226-
// Copyright 2012 Mozilla Corporation. All rights reserved.
1225+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
12271226
// This code is governed by the BSD license found in the LICENSE file.
12281227

12291228
/*---
12301229
es5id: 11.1.1_34
12311230
description: Tests that the option useGrouping is processed correctly.
12321231
author: Norbert Lindenberg
1233-
/Users/caridy/repo/IntlPolyfill.js/tests/test262/harness/testIntl.js
1232+
/Volumes/HOME/Users/andyearnshaw/Development/IntlPolyfill.js/tests/test262/harness/testIntl.js
12341233
---*/
12351234

12361235
testOption(IntlPolyfill.NumberFormat, "useGrouping", "boolean", undefined, true);
1237-
1238-
}
1236+
}
12391237
function runner() {
12401238
var passed = false;
12411239
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_6.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
@@ -1223,7 +1222,7 @@
12231222
}
12241223

12251224

1226-
// Copyright 2012 Mozilla Corporation. All rights reserved.
1225+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
12271226
// This code is governed by the BSD license found in the LICENSE file.
12281227

12291228
/*---
@@ -1232,7 +1231,7 @@
12321231
Tests that the behavior of a Record is not affected by
12331232
adversarial changes to Object.prototype.
12341233
author: Norbert Lindenberg
1235-
/Users/caridy/repo/IntlPolyfill.js/tests/test262/harness/testIntl.js
1234+
/Volumes/HOME/Users/andyearnshaw/Development/IntlPolyfill.js/tests/test262/harness/testIntl.js
12361235
---*/
12371236

12381237
taintProperties(["localeMatcher"]);
@@ -1241,8 +1240,7 @@
12411240
if (!isCanonicalizedStructurallyValidLanguageTag(locale)) {
12421241
throw new Error("NumberFormat returns invalid locale " + locale + ".");
12431242
}
1244-
1245-
}
1243+
}
12461244
function runner() {
12471245
var passed = false;
12481246
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_7.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
@@ -1223,19 +1222,18 @@
12231222
}
12241223

12251224

1226-
// Copyright 2012 Mozilla Corporation. All rights reserved.
1225+
function runTheTest () {// Copyright 2012 Mozilla Corporation. All rights reserved.
12271226
// This code is governed by the BSD license found in the LICENSE file.
12281227

12291228
/*---
12301229
es5id: 11.1.1_7
12311230
description: Tests that the option localeMatcher is processed correctly.
12321231
author: Norbert Lindenberg
1233-
/Users/caridy/repo/IntlPolyfill.js/tests/test262/harness/testIntl.js
1232+
/Volumes/HOME/Users/andyearnshaw/Development/IntlPolyfill.js/tests/test262/harness/testIntl.js
12341233
---*/
12351234

12361235
testOption(IntlPolyfill.NumberFormat, "localeMatcher", "string", ["lookup", "best fit"], "best fit", {noReturn: true});
1237-
1238-
}
1236+
}
12391237
function runner() {
12401238
var passed = false;
12411239
if (typeof document !== "undefined") {

tests/test262/pages/11.1.1_a.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
return __globalObject;
55
}
66
IntlPolyfill.__applyLocaleSensitivePrototypes();
7-
function runTheTest() {
87
try { Object.defineProperty({}, "a", {}) } catch (e) { Object.defineProperty = function (obj, name, desc) {
98
if (desc.hasOwnProperty('value'))
109
obj[name] = desc.value;
@@ -1223,7 +1222,7 @@
12231222
}
12241223

12251224

1226-
// Copyright 2013 Mozilla Corporation. All rights reserved.
1225+
function runTheTest () {// Copyright 2013 Mozilla Corporation. All rights reserved.
12271226
// This code is governed by the BSD license found in the LICENSE file.
12281227

12291228
/*---
@@ -1232,7 +1231,7 @@
12321231
Tests that constructing a NumberFormat doesn't create or modify
12331232
unwanted properties on the RegExp constructor.
12341233
author: Norbert Lindenberg
1235-
/Users/caridy/repo/IntlPolyfill.js/tests/test262/harness/testIntl.js
1234+
/Volumes/HOME/Users/andyearnshaw/Development/IntlPolyfill.js/tests/test262/harness/testIntl.js
12361235
---*/
12371236

12381237
testForUnwantedRegExpChanges(function () {
@@ -1242,8 +1241,7 @@
12421241
testForUnwantedRegExpChanges(function () {
12431242
new IntlPolyfill.NumberFormat("de-DE-u-nu-latn", {style: "currency", currency: "EUR"});
12441243
});
1245-
1246-
}
1244+
}
12471245
function runner() {
12481246
var passed = false;
12491247
if (typeof document !== "undefined") {

0 commit comments

Comments
 (0)