[Pkg-javascript-commits] [node-ripemd160] 51/71: tap instead mocha

Bastien Roucariès rouca at moszumanska.debian.org
Thu May 4 10:25:41 UTC 2017


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

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

commit cc6df2fb781d012b428baa8d5285deb475316d54
Author: Kirill Fomichev <fanatid at ya.ru>
Date:   Mon Feb 29 12:10:44 2016 +0300

    tap instead mocha
---
 lib/ripemd160.js       |  4 ++--
 package.json           | 10 +++++-----
 test/ripemd160.test.js | 35 ++++++++++++++++++++++-------------
 3 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/lib/ripemd160.js b/lib/ripemd160.js
index 0646d6b..64f5817 100644
--- a/lib/ripemd160.js
+++ b/lib/ripemd160.js
@@ -99,7 +99,7 @@ function processBlock (H, words, offset) {
       t = (al + words[offset + zl[i]] + f3(bl, cl, dl) + hl[2]) | 0
     } else if (i < 64) {
       t = (al + words[offset + zl[i]] + f4(bl, cl, dl) + hl[3]) | 0
-    } else {// if (i<80) {
+    } else { // if (i<80) {
       t = (al + words[offset + zl[i]] + f5(bl, cl, dl) + hl[4]) | 0
     }
     t = (rotl(t, sl[i]) + el) | 0
@@ -117,7 +117,7 @@ function processBlock (H, words, offset) {
       t = (ar + words[offset + zr[i]] + f3(br, cr, dr) + hr[2]) | 0
     } else if (i < 64) {
       t = (ar + words[offset + zr[i]] + f2(br, cr, dr) + hr[3]) | 0
-    } else {// if (i<80) {
+    } else { // if (i<80) {
       t = (ar + words[offset + zr[i]] + f1(br, cr, dr) + hr[4]) | 0
     }
     t = (rotl(t, sr[i]) + er) | 0
diff --git a/package.json b/package.json
index fa3944d..e84fecf 100644
--- a/package.json
+++ b/package.json
@@ -13,9 +13,8 @@
   ],
   "license": "BSD-3-Clause",
   "devDependencies": {
-    "mocha": "^2.1.0",
-    "mochify": "^2.1.1",
-    "standard": "3.x"
+    "standard": "^6.0.7",
+    "tap": "^5.7.0"
   },
   "repository": {
     "url": "https://github.com/crypto-browserify/ripemd160",
@@ -24,7 +23,8 @@
   "main": "./lib/ripemd160.js",
   "dependencies": {},
   "scripts": {
-    "test": "standard && mocha test",
-    "browser-test": "mochify --wd -R spec"
+    "lint": "standard",
+    "test": "npm run lint && npm run unit",
+    "unit": "tap test/**/*.js"
   }
 }
diff --git a/test/ripemd160.test.js b/test/ripemd160.test.js
index a461c01..c3a9082 100644
--- a/test/ripemd160.test.js
+++ b/test/ripemd160.test.js
@@ -1,38 +1,47 @@
-var assert = require('assert')
+var tap = require('tap')
 var ripemd160 = require('../')
 
 // from http://homes.esat.kuleuven.be/~bosselae/ripemd160.html
 var fixtures = require('./fixtures')
 
-/* global describe, it */
-
-describe('ripemd160(input)', function () {
+tap.test('ripemd160(input)', function (t) {
   fixtures.valid.forEach(function (f) {
     if (typeof f.data === 'string') {
       if (f.encoding === 'utf8') {
-        describe('> when input (' + f.data + ') encoding is utf8', function () {
-          it('should accept a native string and produce a result', function () {
+        t.test('> when input (' + f.data + ') encoding is utf8', function (t) {
+          t.test('should accept a native string and produce a result', function (t) {
             var result = ripemd160(f.data)
-            assert.equal(result.toString('hex'), (new Buffer(f.result, 'hex')).toString('hex'))
+            t.same(result.toString('hex'), (new Buffer(f.result, 'hex')).toString('hex'))
+            t.end()
           })
+
+          t.end()
         })
       }
 
-      describe('> when input (' + (new Buffer(f.data, f.encoding)).toString('hex') + ')is any encoding', function () {
-        it('should accept a buffer and produce a result', function () {
+      t.test('> when input (' + (new Buffer(f.data, f.encoding)).toString('hex') + ')is any encoding', function (t) {
+        t.test('should accept a buffer and produce a result', function (t) {
           var result = ripemd160(new Buffer(f.data, f.encoding))
-          assert.equal(result.toString('hex'), (new Buffer(f.result, 'hex')).toString('hex'))
+          t.same(result.toString('hex'), (new Buffer(f.result, 'hex')).toString('hex'))
+          t.end()
         })
+
+        t.end()
       })
     }
 
     if (Array.isArray(f.data)) {
-      describe('> when input (' + (new Buffer(f.data)).toString('hex') + ') is an array', function () {
-        it('should accept a buffer and produce a result', function () {
+      t.test('> when input (' + (new Buffer(f.data)).toString('hex') + ') is an array', function (t) {
+        t.test('should accept a buffer and produce a result', function (t) {
           var result = ripemd160(f.data)
-          assert.equal(result.toString('hex'), (new Buffer(f.result, 'hex')).toString('hex'))
+          t.same(result.toString('hex'), (new Buffer(f.result, 'hex')).toString('hex'))
+          t.end()
         })
+
+        t.end()
       })
     }
   })
+
+  t.end()
 })

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



More information about the Pkg-javascript-commits mailing list