Skip to content
Permalink
Browse files

Removed assertion attachment. Updating core test suite.

  • Loading branch information...
atesgoral committed Aug 2, 2009
1 parent 5f8f239 commit fedee5d1602e4406bf72d7bf79df69f13aef8186
Showing with 101 additions and 132 deletions.
  1. +1 −1 assert.js
  2. +4 −16 jsunity.js
  3. +92 −112 test/core.js
  4. +4 −3 test/run.html
@@ -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]); })
@@ -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) {
@@ -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,
@@ -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;
Oops, something went wrong.

0 comments on commit fedee5d

Please sign in to comment.
You can’t perform that action at this time.