jasmine.log() and Spec#log() take multiple arguments which are pretty-printed and concatted together.

Log messages are handled correctly in TrivialReporter and JsApiReporter.
This commit is contained in:
Lee Byrd & Christian Williams
2010-06-22 12:23:54 -07:00
parent 3bdc96c00a
commit e7cd6a473a
11 changed files with 124 additions and 55 deletions

View File

@@ -51,14 +51,23 @@ jasmine.clearTimeout = jasmine.bindOriginal_(window, 'clearTimeout');
jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval');
jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval');
jasmine.MessageResult = function(text) {
jasmine.MessageResult = function(values) {
this.type = 'MessageResult';
this.text = text;
this.values = values;
this.trace = new Error(); // todo: test better
};
jasmine.MessageResult.prototype.toString = function() {
return this.text;
var text = "";
for(var i = 0; i < this.values.length; i++) {
if (i > 0) text += " ";
if (jasmine.isString_(this.values[i])) {
text += this.values[i];
} else {
text += jasmine.pp(this.values[i]);
}
}
return text;
};
jasmine.ExpectationResult = function(params) {
@@ -395,8 +404,9 @@ jasmine.createSpyObj = function(baseName, methodNames) {
return obj;
};
jasmine.log = function(message) {
jasmine.getEnv().currentSpec.log(message);
jasmine.log = function() {
var spec = jasmine.getEnv().currentSpec;
spec.log.apply(spec, arguments);
};
/**