make sure test passes on IE
This commit is contained in:
parent
db5c87a031
commit
5d83b20903
1 changed files with 9 additions and 2 deletions
|
|
@ -53,14 +53,21 @@ assert.AssertionError = function AssertionError(options) {
|
||||||
};
|
};
|
||||||
oop.inherits(assert.AssertionError, Error);
|
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() {
|
assert.AssertionError.prototype.toString = function() {
|
||||||
if (this.message) {
|
if (this.message) {
|
||||||
return [this.name + ':', this.message].join(' ');
|
return [this.name + ':', this.message].join(' ');
|
||||||
} else {
|
} else {
|
||||||
return [this.name + ':',
|
return [this.name + ':',
|
||||||
JSON.stringify(this.expected),
|
toJSON(this.expected),
|
||||||
this.operator,
|
this.operator,
|
||||||
JSON.stringify(this.actual)].join(' ');
|
toJSON(this.actual)].join(' ');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue