make sure test passes on IE

This commit is contained in:
Fabian Jakobs 2011-08-16 11:02:50 +02:00
commit 5d83b20903

View file

@ -53,14 +53,21 @@ assert.AssertionError = function AssertionError(options) {
};
oop.inherits(assert.AssertionError, Error);
toJSON = function(obj) {
if (typeof JSON !== "undefined")
return JSON.stringify(obj);
else
return obj.toString();
}
assert.AssertionError.prototype.toString = function() {
if (this.message) {
return [this.name + ':', this.message].join(' ');
} else {
return [this.name + ':',
JSON.stringify(this.expected),
toJSON(this.expected),
this.operator,
JSON.stringify(this.actual)].join(' ');
toJSON(this.actual)].join(' ');
}
};