mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
Bug 483407 - Improve the "mochitest*" harness; (Av1a) SimpleTest.js: Report tests which did not actually check anything, Improve ToDo support; r=dbaron
This commit is contained in:
parent
b323b81296
commit
010c09145a
@ -107,6 +107,12 @@ SimpleTest.report = function () {
|
||||
var passed = 0;
|
||||
var failed = 0;
|
||||
var todo = 0;
|
||||
|
||||
// Report tests which did not actually check anything.
|
||||
if (SimpleTest._tests.length == 0)
|
||||
// ToDo: Do s/todo/ok/ when all the tests are fixed. (Bug 483407)
|
||||
SimpleTest.todo(false, "[SimpleTest.report()] No checks actually run.");
|
||||
|
||||
var results = MochiKit.Base.map(
|
||||
function (test) {
|
||||
var cls, msg;
|
||||
@ -114,7 +120,7 @@ SimpleTest.report = function () {
|
||||
todo++;
|
||||
cls = "test_todo";
|
||||
msg = "todo - " + test.name + " " + test.diag;
|
||||
} else if (test.result &&!test.todo) {
|
||||
} else if (test.result && !test.todo) {
|
||||
passed++;
|
||||
cls = "test_ok";
|
||||
msg = "ok - " + test.name;
|
||||
@ -127,7 +133,10 @@ SimpleTest.report = function () {
|
||||
},
|
||||
SimpleTest._tests
|
||||
);
|
||||
var summary_class = ((failed == 0) ? 'all_pass' : 'some_fail');
|
||||
|
||||
var summary_class = failed != 0 ? 'some_fail' :
|
||||
passed == 0 ? 'todo_only' : 'all_pass';
|
||||
|
||||
return DIV({'class': 'tests_report'},
|
||||
DIV({'class': 'tests_summary ' + summary_class},
|
||||
DIV({'class': 'tests_passed'}, "Passed: " + passed),
|
||||
@ -163,10 +172,12 @@ SimpleTest.toggleByClass = function (cls, evt) {
|
||||
**/
|
||||
|
||||
SimpleTest.showReport = function() {
|
||||
var togglePassed = A({'href': '#'}, "Toggle passed tests");
|
||||
var toggleFailed = A({'href': '#'}, "Toggle failed tests");
|
||||
var togglePassed = A({'href': '#'}, "Toggle passed checks");
|
||||
var toggleFailed = A({'href': '#'}, "Toggle failed checks");
|
||||
var toggleTodo = A({'href': '#'}, "Toggle todo checks");
|
||||
togglePassed.onclick = partial(SimpleTest.toggleByClass, 'test_ok');
|
||||
toggleFailed.onclick = partial(SimpleTest.toggleByClass, 'test_not_ok');
|
||||
toggleTodo.onclick = partial(SimpleTest.toggleByClass, 'test_todo');
|
||||
var body = document.body; // Handles HTML documents
|
||||
if (!body) {
|
||||
// Do the XML thing
|
||||
@ -187,6 +198,8 @@ SimpleTest.showReport = function() {
|
||||
addNode(togglePassed);
|
||||
addNode(SPAN(null, " "));
|
||||
addNode(toggleFailed);
|
||||
addNode(SPAN(null, " "));
|
||||
addNode(toggleTodo);
|
||||
addNode(SimpleTest.report());
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user