summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-09-07 16:28:49 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-09-07 17:14:04 -0700
commit1be722a2712e9959c204824604df3ab69612cbb0 (patch)
treee9f1ad299d6a7597dcc275ed2e1fade97e4bb481
parent3c00ec4e484da4b607f65fc56f997fe929254bc1 (diff)
downloadnode-new-1be722a2712e9959c204824604df3ab69612cbb0.tar.gz
Special deepEquals for buffer
-rw-r--r--lib/assert.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/assert.js b/lib/assert.js
index 2d1fc08001..19cb376c7e 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -131,6 +131,15 @@ function _deepEqual(actual, expected) {
if (actual === expected) {
return true;
+ } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) {
+ if (actual.length != expected.length) return false;
+
+ for (var i = 0; i < actual.length; i++) {
+ if (actual[i] !== expected[i]) return false;
+ }
+
+ return true;
+
// 7.2. If the expected value is a Date object, the actual value is
// equivalent if it is also a Date object that refers to the same time.
} else if (actual instanceof Date && expected instanceof Date) {