aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMark Miller <erights@gmail.com>2011-09-24 16:16:50 -0700
committerMark Miller <erights@gmail.com>2011-09-24 16:16:50 -0700
commit5c91ef1cb8890cca4b169522cf7bb578a829e7ce (patch)
tree6df9193dc5bb8448b891ecd711fa4f6b723bb96d /test
parentbb29020ab211e07a0d382a621d9d349f05b374f1 (diff)
parentab1142e49819d61dacf3d77f0f8411e6f7effa03 (diff)
Merged
Diffstat (limited to 'test')
-rw-r--r--test/harness/gs.js10
-rw-r--r--test/harness/helper.js5
-rw-r--r--test/harness/sta.js50
-rw-r--r--test/harness/sth.js21
4 files changed, 43 insertions, 43 deletions
diff --git a/test/harness/gs.js b/test/harness/gs.js
index bd57897c9..6916a1fd9 100644
--- a/test/harness/gs.js
+++ b/test/harness/gs.js
@@ -23,28 +23,28 @@
//An exception is expected
if (testDescrip.negative !== undefined) {
if (window.iframeError === undefined) { //no exception was thrown
- testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code, typeof testDescrip.precondition !== 'undefined' ? testDescrip.precondition.toString() : '',
+ testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code,
'fail',
Error('No exception was thrown; expected an error "message" property matching the regular expression "' + testDescrip.negative + '".'));
} else if (!(new RegExp(testDescrip.negative, "i").test(window.iframeError))) { //wrong type of exception thrown
- testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code, typeof testDescrip.precondition !== 'undefined' ? testDescrip.precondition.toString() : '',
+ testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code,
'fail',
Error('Expected an exception with a "message" property matching the regular expression "' + testDescrip.negative +'" to be thrown; actual was "' + window.iframeError + '".'));
} else {
- testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code, typeof testDescrip.precondition !== 'undefined' ? testDescrip.precondition.toString() : '',
+ testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code,
'pass', undefined);
}
}
//Exception was not expected to be thrown
else if (window.iframeError !== undefined) {
- testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code, typeof testDescrip.precondition !== 'undefined' ? testDescrip.precondition.toString() : '',
+ testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code,
'fail',
Error('Unexpected exception, "' + window.iframeError + '" was thrown.'));
}
else {
- testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code, typeof testDescrip.precondition !== 'undefined' ? testDescrip.precondition.toString() : '',
+ testRun(testDescrip.id, testDescrip.path, testDescrip.description, testDescrip.code,
'pass', undefined);
}
diff --git a/test/harness/helper.js b/test/harness/helper.js
index adf96c02d..709c4f155 100644
--- a/test/harness/helper.js
+++ b/test/harness/helper.js
@@ -160,11 +160,6 @@ function Presenter() {
innerHTML += '<br /><br /><br /><b>Testcase</b>';
innerHTML += '<pre>' + test.code + '</pre>';
- if (test.pre) {
- innerHTML += '<b>Precondition</b>';
- innerHTML += '<pre>' + test.pre + '</pre>';
- }
-
innerHTML += '<b>Path</b>';
innerHTML += '<pre>' + test.path + ' </pre>&nbsp';
diff --git a/test/harness/sta.js b/test/harness/sta.js
index b76c26d44..97c971f01 100644
--- a/test/harness/sta.js
+++ b/test/harness/sta.js
@@ -288,38 +288,28 @@ var NotEarlyError = new Error(NotEarlyErrorString);
var ES5Harness = {};
ES5Harness.registerTest = function (test) {
var error;
- //Has a test precondition set, but the precondition fails
- if (test.precondition && !test.precondition()) {
- testRun(test.id, test.path, test.description, test.test.toString(),
- typeof test.precondition !== 'undefined' ? test.precondition.toString() : '',
- 'fail', Error('Precondition Failed'));
- }
- //We're good to actually run the test case
- else {
- try {
- if (test.strict!==undefined) {
- var res = test.test();
- } else {
- var res = test.test.call(window);
- }
+ try {
+ if (test.strict!==undefined) {
+ var res = test.test();
+ } else {
+ var res = test.test.call(window);
+ }
- } catch (e) {
- res = 'fail';
- error = e;
- if (!(e instanceof Error)) {
- try {
- error = Error(e.toString());
- } catch (e2) {
- error = Error("test262: unknown error in test case or ECMAScript implementation");
- }
+ } catch (e) {
+ res = 'fail';
+ error = e;
+ if (!(e instanceof Error)) {
+ try {
+ error = Error(e.toString());
+ } catch (e2) {
+ error = Error("test262: unknown error in test case or ECMAScript implementation");
}
}
- //Sputnik and IE Test Center tests are a bit different in terms of return values.
- //That is, IE Test Center will always return 'true' IFF the test passed. Sputnik
- //test cases will return either 'true' or 'undefined' if they pass.
- var retVal = /^s/i.test(test.id) ? (res === true || typeof res === 'undefined' ? 'pass' : 'fail') : (res === true ? 'pass' : 'fail');
- testRun(test.id, test.path, test.description, test.test.toString(),
- typeof test.precondition !== 'undefined' ? test.precondition.toString() : '',
- retVal, error);
}
+ //Sputnik and IE Test Center tests are a bit different in terms of return values.
+ //That is, IE Test Center will always return 'true' IFF the test passed. Sputnik
+ //test cases will return either 'true' or 'undefined' if they pass.
+ var retVal = /^s/i.test(test.id) ? (res === true || typeof res === 'undefined' ? 'pass' : 'fail') : (res === true ? 'pass' : 'fail');
+ testRun(test.id, test.path, test.description, test.test.toString(),
+ retVal, error);
}
diff --git a/test/harness/sth.js b/test/harness/sth.js
index 4df798a36..50d6adabf 100644
--- a/test/harness/sth.js
+++ b/test/harness/sth.js
@@ -87,14 +87,13 @@ function BrowserRunner() {
}
/* Called from the child window after the test has run. */
- function testRun(id, path, description, codeString, preconditionString, result, error) {
+ function testRun(id, path, description, codeString, result, error) {
currentTest.id = id;
currentTest.path = path;
currentTest.description = description;
currentTest.result = result;
currentTest.error = error;
currentTest.code = codeString;
- currentTest.pre = preconditionString;
}
@@ -279,6 +278,21 @@ function TestLoader() {
}});
}
+ this.getIdFromPath = function(path) {
+ //path is of the form "a/b/c.js"
+
+ var id = path.split("/");
+ //id is now of the form ["a", "b", "c.js"];
+
+ id = id[id.length-1];
+ //id is now of the form "c.js"
+
+ id = id.replace(/\.js$/i, "");
+ //id is now of the form "c"
+
+ return id;
+ }
+
/* Move on to the next test */
this.getNextTest = function() {
if(testGroups.length == 0) {
@@ -287,7 +301,8 @@ function TestLoader() {
} else if(currentTestIndex < testGroups[testGroupIndex].tests.length) {
// We have tests left in this test group.
var test = testGroups[testGroupIndex].tests[currentTestIndex++];
- var scriptCode = test.code;
+ var scriptCode = test.code;
+ scriptCode.id = getIdFromPath(test.path);
//var scriptCode = (test.firstChild.text != undefined) ?
// test.firstChild.text : test.firstChild.textContent;