From 9c78766ded11a1c121d33ad8a57ee34603c923e0 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 9 Sep 2011 15:35:51 -0400 Subject: [PATCH] fix jsDump parsing --- js-lib/jsDump.js | 6 +++++- lib/jasmine/template_writer.rb | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js-lib/jsDump.js b/js-lib/jsDump.js index 05b90f7..af1c7d9 100644 --- a/js-lib/jsDump.js +++ b/js-lib/jsDump.js @@ -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]); } diff --git a/lib/jasmine/template_writer.rb b/lib/jasmine/template_writer.rb index 83242c7..2ba834e 100644 --- a/lib/jasmine/template_writer.rb +++ b/lib/jasmine/template_writer.rb @@ -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); } } }