[Pkg-javascript-commits] [node-sha.js] 54/237: update hash tests - for some reason, t.deepEqual doesn't work well on buffers?

Bastien Roucariès rouca at moszumanska.debian.org
Fri May 5 09:02:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-sha.js.

commit 8e8e8547612af4cb628400be0933edeb856f28a5
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Fri Dec 27 21:15:30 2013 +0700

    update hash tests - for some reason, t.deepEqual doesn't work well on buffers?
---
 test/hash.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/test/hash.js b/test/hash.js
index 102dec6..974da42 100644
--- a/test/hash.js
+++ b/test/hash.js
@@ -5,6 +5,11 @@ var u = require('../util')
 var tape = require('tape')
 
 var hex = '0A1B2C3D4E5F6G7H', hexbuf
+function equal(t, a,b) {
+  t.equal(a.length, b.length)
+  for(var i = 0; i < a.length; i++)
+    t.equal(a[i], b[i])
+}
 
 var count16 = {
       strings: ['0A1B2C3D4E5F6G7H'],
@@ -67,10 +72,10 @@ function makeTest(name, data) {
     var hash = new Uint8Array(20)
     var n = 2
     var expected = data.buffers.slice()
-    t.plan(expected.length + 1)
+    //t.plan(expected.length + 1)
     h._update = function (block) {
       var e = expected.shift()
-      t.deepEqual(block, e.buffer)
+      equal(t, block, e.buffer)
       if(n < 0)
         throw new Error('expecting only 2 calls to _update')
 
@@ -81,7 +86,7 @@ function makeTest(name, data) {
       h.update(string, 'ascii')
     })
 
-    t.equal(h.digest(), hash)
+    equal(t, h.digest(), hash)
     t.end()
 
   })

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-sha.js.git



More information about the Pkg-javascript-commits mailing list