From 9a08f51a728b81a10fe17c412848257ddc93f6af Mon Sep 17 00:00:00 2001 From: Brian Carlson Date: Fri, 14 Jan 2011 15:18:56 -0600 Subject: [PATCH] better printing of actual/expected buffers in error for visual compare --- test/test-helper.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/test-helper.js b/test/test-helper.js index fbeaa4d..9f2a4ff 100644 --- a/test/test-helper.js +++ b/test/test-helper.js @@ -64,18 +64,21 @@ assert.UTCDate = function(actual, year, month, day, hours, min, sec, milisecond) assert.equal(actualMili, milisecond, "expected milisecond " + milisecond + " but got " + actualMili); }; +var spit = function(actual, expected) { + console.log(""); + console.log("actual " + sys.inspect(actual)); + console.log("expect " + sys.inspect(expected)); + console.log(""); +} + assert.equalBuffers = function(actual, expected) { if(actual.length != expected.length) { - console.log(""); - console.log("actual " + sys.inspect(actual)); - console.log("expect " + sys.inspect(expected)); - console.log(""); + spit(actual, expected) assert.equal(actual.length, expected.length); } for(var i = 0; i < actual.length; i++) { if(actual[i] != expected[i]) { - console.log(actual); - console.log(expected); + spit(actual, expected) } assert.equal(actual[i],expected[i]); }