Add line numbers to failures when unit testing in Firefox. Closes #9231.

This commit is contained in:
Thomas Fuchs 2007-08-09 21:48:14 +00:00
parent e75cd0acdd
commit f3d9cb2579
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Add line numbers to failures when unit testing in Firefox. Closes #9231. [John Resig]
* Fix Function#argumentNames for Opera and IE. [Thomas Fuchs]
* Add Object.isString, Object.isNumber, and Object.isUndefined, and clean up the source to make use of Object.isXXX where possible. [sam]

View File

@ -277,7 +277,15 @@ Test.Unit.Assertions.prototype = {
},
fail: function(message) {
this.failures++;
this.messages.push("Failure: " + message);
var line = "";
try {
throw new Error("stack");
} catch(e){
line = (/\.html:(\d+)/.exec(e.stack || '') || ['',''])[1];
}
this.messages.push("Failure: " + message + (line ? " Line #" + line : ""));
},
info: function(message) {
this.messages.push("Info: " + message);