mirror of https://github.com/tc39/test262.git
Merge pull request #68 from smikes/remove-unused-harness
harness: remove unused code
This commit is contained in:
commit
64756c252e
|
@ -10,6 +10,30 @@ function testRun(id, path, description, codeString, result, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testFinished() {
|
// define a default `print` function for async tests where there is no
|
||||||
//no-op
|
// global `print`
|
||||||
|
var print;
|
||||||
|
|
||||||
|
// in node use console.log
|
||||||
|
if (typeof console === "object") {
|
||||||
|
print = function () {
|
||||||
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
console.log(args.join(" "));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// in WScript, use WScript.Echo
|
||||||
|
if (typeof WScript === "object") {
|
||||||
|
print = function () {
|
||||||
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
WScript.Echo(args.join(" "));
|
||||||
|
};
|
||||||
|
|
||||||
|
// also override $ERROR to force a nonzero exit code exit
|
||||||
|
// TODO? report syntax errors
|
||||||
|
var oldError = $ERROR;
|
||||||
|
$ERROR = function (message) {
|
||||||
|
print("Test262 Error: " + message);
|
||||||
|
WScript.Quit(1);
|
||||||
|
};
|
||||||
}
|
}
|
|
@ -12,20 +12,3 @@ if (this.window!==undefined) { //for console support
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//This doesn't work with early errors in current versions of Opera
|
|
||||||
/*
|
|
||||||
if (/opera/i.test(navigator.userAgent)) {
|
|
||||||
(function() {
|
|
||||||
var origError = window.Error;
|
|
||||||
window.Error = function() {
|
|
||||||
if (arguments.length>0) {
|
|
||||||
try {
|
|
||||||
window.onerror(arguments[0]);
|
|
||||||
} catch(e) {
|
|
||||||
alert("Failed to invoke window.onerror (from ed.js)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return origError.apply(this, arguments);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
}*/
|
|
|
@ -4,31 +4,23 @@
|
||||||
/// "Use Terms"). Any redistribution of this code must retain the above
|
/// "Use Terms"). Any redistribution of this code must retain the above
|
||||||
/// copyright and this notice and otherwise comply with the Use Terms.
|
/// copyright and this notice and otherwise comply with the Use Terms.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
var NotEarlyErrorString = "NotEarlyError";
|
var NotEarlyErrorString = "NotEarlyError";
|
||||||
var EarlyErrorRePat = "^((?!" + NotEarlyErrorString + ").)*$";
|
var EarlyErrorRePat = "^((?!" + NotEarlyErrorString + ").)*$";
|
||||||
var NotEarlyError = new Error(NotEarlyErrorString);
|
var NotEarlyError = new Error(NotEarlyErrorString);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
|
|
||||||
function Test262Error(message) {
|
function Test262Error(message) {
|
||||||
if (message) this.message = message;
|
this.message = message || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
Test262Error.prototype.toString = function () {
|
Test262Error.prototype.toString = function () {
|
||||||
return "Test262 Error: " + this.message;
|
return "Test262 Error: " + this.message;
|
||||||
};
|
};
|
||||||
|
|
||||||
function testFailed(message) {
|
var $ERROR;
|
||||||
|
$ERROR = function $ERROR(message) {
|
||||||
throw new Test262Error(message);
|
throw new Test262Error(message);
|
||||||
}
|
};
|
||||||
|
|
||||||
function $INCLUDE(message) { }
|
function testFailed(message) {
|
||||||
function $ERROR(message) {
|
$ERROR(message);
|
||||||
testFailed(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ def BuildOptions():
|
||||||
result.add_option("--junitname", help="Filename to save test results in JUnit XML format")
|
result.add_option("--junitname", help="Filename to save test results in JUnit XML format")
|
||||||
result.add_option("--loglevel", default="warning",
|
result.add_option("--loglevel", default="warning",
|
||||||
help="sets log level to debug, info, warning, error, or critical")
|
help="sets log level to debug, info, warning, error, or critical")
|
||||||
result.add_option("--print-handle", default="", help="Command to print from console")
|
result.add_option("--print-handle", default="print", help="Command to print from console")
|
||||||
result.add_option("--list-includes", default=False, action="store_true",
|
result.add_option("--list-includes", default=False, action="store_true",
|
||||||
help="List includes required by tests")
|
help="List includes required by tests")
|
||||||
return result
|
return result
|
||||||
|
@ -261,11 +261,22 @@ class TestCase(object):
|
||||||
def GetAdditionalIncludes(self):
|
def GetAdditionalIncludes(self):
|
||||||
return '\n'.join([self.suite.GetInclude(include) for include in self.GetIncludeList()])
|
return '\n'.join([self.suite.GetInclude(include) for include in self.GetIncludeList()])
|
||||||
|
|
||||||
def GetSource(self):
|
def WrapTest(self, command):
|
||||||
|
if "cscript" not in command:
|
||||||
|
return self.test
|
||||||
|
|
||||||
|
return """
|
||||||
|
try {
|
||||||
|
""" + self.test + """
|
||||||
|
} catch(e) {
|
||||||
|
$ERROR(e.message);
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
def GetSource(self, command_template):
|
||||||
# "var testDescrip = " + str(self.testRecord) + ';\n\n' + \
|
# "var testDescrip = " + str(self.testRecord) + ';\n\n' + \
|
||||||
source = self.suite.GetInclude("cth.js") + \
|
source = self.suite.GetInclude("sta.js") + \
|
||||||
self.suite.GetInclude("sta.js") + \
|
self.suite.GetInclude("cth.js")
|
||||||
self.suite.GetInclude("ed.js")
|
|
||||||
|
|
||||||
if self.IsAsyncTest():
|
if self.IsAsyncTest():
|
||||||
source = source + \
|
source = source + \
|
||||||
|
@ -274,12 +285,14 @@ class TestCase(object):
|
||||||
|
|
||||||
source = source + \
|
source = source + \
|
||||||
self.GetAdditionalIncludes() + \
|
self.GetAdditionalIncludes() + \
|
||||||
self.test + '\n'
|
self.WrapTest(command_template) + '\n'
|
||||||
|
|
||||||
if self.strict_mode:
|
if self.strict_mode:
|
||||||
source = '"use strict";\nvar strict_mode = true;\n' + source
|
source = '"use strict";\nvar strict_mode = true;\n' + source
|
||||||
else:
|
else:
|
||||||
source = "var strict_mode = false; \n" + source
|
# add comment line so line numbers match in both strict and non-strict version
|
||||||
|
source = '//"no strict";\nvar strict_mode = false;\n' + source
|
||||||
|
|
||||||
return source
|
return source
|
||||||
|
|
||||||
def InstantiateTemplate(self, template, params):
|
def InstantiateTemplate(self, template, params):
|
||||||
|
@ -312,7 +325,7 @@ class TestCase(object):
|
||||||
return (code, out, err)
|
return (code, out, err)
|
||||||
|
|
||||||
def RunTestIn(self, command_template, tmp):
|
def RunTestIn(self, command_template, tmp):
|
||||||
tmp.Write(self.GetSource())
|
tmp.Write(self.GetSource(command_template))
|
||||||
tmp.Close()
|
tmp.Close()
|
||||||
command = self.InstantiateTemplate(command_template, {
|
command = self.InstantiateTemplate(command_template, {
|
||||||
'path': tmp.name
|
'path': tmp.name
|
||||||
|
@ -329,7 +342,7 @@ class TestCase(object):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def Print(self):
|
def Print(self):
|
||||||
print self.GetSource()
|
print self.GetSource("")
|
||||||
|
|
||||||
|
|
||||||
class ProgressIndicator(object):
|
class ProgressIndicator(object):
|
||||||
|
|
Loading…
Reference in New Issue