fix jsDump parsing

This commit is contained in:
John Bintz 2011-09-09 15:35:51 -04:00
parent dc134dcf24
commit 9c78766ded
2 changed files with 7 additions and 3 deletions

View File

@ -39,6 +39,10 @@ var jsDump;
var reName = /^function (\w+)/;
jsDump = {
doParse:function(obj) {
this.alreadySeenObjects = [];
return this.parse(obj);
},
parse:function( obj, type ){//type is used mostly internally, you can fix a (custom)type in advance
var parser = this.parsers[ type || this.typeOf(obj) ];
type = typeof parser;
@ -146,7 +150,7 @@ var jsDump;
if (!this.ignoreFunctions || this.typeOf(map[key]) != 'function') {
var value = "<< LOOP >>";
if (this.alreadySeenObjects.indexOf(map[key]) == -1) {
if ((typeof map[key] != 'object') || this.alreadySeenObjects.indexOf(map[key]) == -1) {
this.alreadySeenObjects.push(map[key]);
value = this.parse(map[key]);
}

View File

@ -40,11 +40,11 @@ module Jasmine
} catch (e) {}
if (usejsDump) {
var dump = jsDump.parse(data);
var dump = jsDump.doParse(data);
if (dump.indexOf("\\n") == -1) {
JHW.log(dump);
} else {
JHW.log("jsDump: " + jsDump.parse(data));
JHW.log("jsDump: " + dump);
}
}
}