Skip to content

Commit

Permalink
output function name in AssertionError, if {expected} is a function
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 16, 2010
1 parent 0b32f54 commit 5f415df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/assert/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ require('assert').AssertionError.prototype.toString = function () {

function parse(str) {
return str.replace(/{actual}/g, inspect(that.actual)).
replace(/{expected}/g, inspect(that.expected)).
replace(/{operator}/g, stylize(that.operator, 'bold'));
replace(/{operator}/g, stylize(that.operator, 'bold')).
replace(/{expected}/g, (that.expected instanceof Function)
? that.expected.name
: inspect(that.expected));
}

if (this.message) {
Expand Down

0 comments on commit 5f415df

Please sign in to comment.