better printing of actual/expected buffers in error for visual compare
This commit is contained in:
parent
fd1dd95b43
commit
9a08f51a72
@ -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);
|
assert.equal(actualMili, milisecond, "expected milisecond " + milisecond + " but got " + actualMili);
|
||||||
};
|
};
|
||||||
|
|
||||||
assert.equalBuffers = function(actual, expected) {
|
var spit = function(actual, expected) {
|
||||||
if(actual.length != expected.length) {
|
|
||||||
console.log("");
|
console.log("");
|
||||||
console.log("actual " + sys.inspect(actual));
|
console.log("actual " + sys.inspect(actual));
|
||||||
console.log("expect " + sys.inspect(expected));
|
console.log("expect " + sys.inspect(expected));
|
||||||
console.log("");
|
console.log("");
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.equalBuffers = function(actual, expected) {
|
||||||
|
if(actual.length != expected.length) {
|
||||||
|
spit(actual, expected)
|
||||||
assert.equal(actual.length, expected.length);
|
assert.equal(actual.length, expected.length);
|
||||||
}
|
}
|
||||||
for(var i = 0; i < actual.length; i++) {
|
for(var i = 0; i < actual.length; i++) {
|
||||||
if(actual[i] != expected[i]) {
|
if(actual[i] != expected[i]) {
|
||||||
console.log(actual);
|
spit(actual, expected)
|
||||||
console.log(expected);
|
|
||||||
}
|
}
|
||||||
assert.equal(actual[i],expected[i]);
|
assert.equal(actual[i],expected[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user