dwf/rva: added better exception handling for Webkit
This commit is contained in:
@@ -210,6 +210,11 @@ Jasmine.Matchers.method('should_be_defined', function () {
|
||||
'Expected ' + this.actual + ' to be defined.');
|
||||
});
|
||||
|
||||
Jasmine.Matchers.method('innerHTML_should_match', function (reg_exp) {
|
||||
return this.report((reg_exp.match(this.actual.innerHTML)),
|
||||
'Expected ' + this.actual.innerHTML + ' to match ' + reg_exp + '.');
|
||||
});
|
||||
|
||||
/*
|
||||
* Jasmine spec constructor
|
||||
*/
|
||||
@@ -254,8 +259,7 @@ var it = function (description, func) {
|
||||
catch (e) {
|
||||
that.results.push({
|
||||
passed: false,
|
||||
message: e.name + ': '+ e.message + ' in ' + e.fileName +
|
||||
' (line ' + e.lineNumber +')'
|
||||
message: Jasmine.Util.formatException(e)
|
||||
});
|
||||
queuedFunc.next();
|
||||
}
|
||||
@@ -387,4 +391,36 @@ Jasmine.Reporters.reporter = function (callbacks) {
|
||||
}
|
||||
|
||||
return that;
|
||||
}
|
||||
|
||||
Jasmine.Util = {
|
||||
formatException: function(e) {
|
||||
// if (typeof e === 'String') {
|
||||
// return e;
|
||||
// }
|
||||
var lineNumber;
|
||||
if (e.line) {
|
||||
lineNumber = e.line;
|
||||
}
|
||||
else if (e.lineNumber) {
|
||||
lineNumber = e.lineNumber;
|
||||
}
|
||||
|
||||
var file;
|
||||
|
||||
if (e.sourceURL) {
|
||||
file = e.sourceURL;
|
||||
}
|
||||
else if (e.fileName) {
|
||||
file = e.fileName;
|
||||
}
|
||||
|
||||
var message = e.name + ': ' + e.message;
|
||||
if (file && lineNumber) {
|
||||
message += ' in ' + file +' (line ' + lineNumber + ')';
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user