Skip to content

Commit

Permalink
Removed assertion attachment. Updating core test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
atesgoral committed Aug 2, 2009
1 parent 5f8f239 commit fedee5d
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 132 deletions.
2 changes: 1 addition & 1 deletion assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ assert.fail = function (message) {
("isFalse", function () { return arguments[0] === false; })
("match", function () { return arguments[0].test(arguments[1]); })
("typeOf", function () { return typeof arguments[1] === arguments[0]; })
("instanceOf", function () { return arguments[0] instanceof arguments[1]; })
("instanceOf", function () { return arguments[1] instanceof arguments[0]; })
("isNull", function () { return arguments[0] === null; })
("isUndefined", function () { return arguments[0] === undefined; })
("isNaN", function () { return isNaN(arguments[0]); })
Expand Down
20 changes: 4 additions & 16 deletions jsunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ jsUnity = (function () {
logStream.info("[PASSED] " + testName);
}

function resultsFail(index, testName, message) {
function resultsFail(index, testName, error) {
resultsStream.fail.apply(this, arguments);

tapStream.write(fmt("not ok {0} - {1}", index, testName));
tapStream.write(" ---");
tapStream.write(" " + message);
tapStream.write(" " + error.message);
tapStream.write(" ...");
logStream.info(fmt("[FAILED] {0}: {1}", testName, message));
logStream.info(fmt("[FAILED] {0}: {1}", testName, error.message));
}

function resultsEnd(passed, failed, duration) {
Expand Down Expand Up @@ -217,23 +217,11 @@ jsUnity = (function () {
this.tests = [];
},

assertions: defaultAssertions,

env: {
defaultScope: this,

getDate: function () {
return new Date();
}
},

attachAssertions: function (scope) {
scope = scope || this.env.defaultScope;

for (var fn in jsUnity.assertions) {
scope[fn] = jsUnity.assertions[fn];
}
},

results: resultsStream,
log: logStream,
Expand Down Expand Up @@ -317,7 +305,7 @@ jsUnity = (function () {
resultsFail(j + 1, test.name, e);

testOutcome.passed = false;
testOutcome.failureMessage = e;
testOutcome.error = e;
}

testOutcome.duration = jsUnity.env.getDate() - testStart;
Expand Down
Loading

0 comments on commit fedee5d

Please sign in to comment.