clean up unused test code
This commit is contained in:
parent
dbee97bf04
commit
d6911d105b
1 changed files with 0 additions and 42 deletions
|
|
@ -1,60 +1,18 @@
|
||||||
//make "use strict" and nodejs happy
|
|
||||||
var window = this
|
|
||||||
|
|
||||||
//test reporting for saucelabs
|
|
||||||
if (typeof window != "undefined") {
|
|
||||||
window.global_test_results = {
|
|
||||||
tests: [],
|
|
||||||
duration: 0,
|
|
||||||
passed: 0,
|
|
||||||
failed: 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.console) {
|
if (!this.console) {
|
||||||
var log = function(value) {document.write("<pre>" + value + "</pre>")}
|
var log = function(value) {document.write("<pre>" + value + "</pre>")}
|
||||||
this.console = {log: log, error: log}
|
this.console = {log: log, error: log}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test(condition) {
|
function test(condition) {
|
||||||
var duration = 0
|
|
||||||
var start = 0
|
|
||||||
var result = true
|
|
||||||
test.total++
|
test.total++
|
||||||
|
|
||||||
if (typeof performance != "undefined" && performance.now) {
|
|
||||||
start = performance.now()
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (!condition()) throw new Error("failed")
|
if (!condition()) throw new Error("failed")
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
result = false
|
|
||||||
console.error(e)
|
console.error(e)
|
||||||
test.failures.push(condition)
|
test.failures.push(condition)
|
||||||
}
|
}
|
||||||
if (typeof performance != "undefined" && performance.now) {
|
|
||||||
duration = performance.now() - start
|
|
||||||
}
|
|
||||||
|
|
||||||
window.test_obj = {
|
|
||||||
name: "" + test.total,
|
|
||||||
result: result,
|
|
||||||
duration: duration
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof window != "undefined") {
|
|
||||||
if (!result) {
|
|
||||||
window.global_test_results.tests.push(window.test_obj)
|
|
||||||
}
|
|
||||||
|
|
||||||
window.global_test_results.duration += duration
|
|
||||||
if (result) {
|
|
||||||
window.global_test_results.passed++
|
|
||||||
} else {
|
|
||||||
window.global_test_results.failed++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
test.total = 0
|
test.total = 0
|
||||||
test.failures = []
|
test.failures = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue