Permalink
Browse files

self-referential test using tap

  • Loading branch information...
1 parent 3cea9d8 commit de1ab084e162c973e8165eaabd597947f417d2ef @substack committed Nov 3, 2011
Showing with 12 additions and 15 deletions.
  1. +12 −15 test/self-referential.js
View
@@ -1,40 +1,37 @@
var dnode = require('../')
-var assert = require('assert');
-var util = require('util');
+var test = require('tap').test;
-exports.simple = function () {
+test('simple', function (t) {
+ t.plan(6);
var port = Math.floor(Math.random() * 40000 + 10000);
var server = dnode({
timesTen : function (n,reply) {
- assert.equal(n.number, 5);
+ t.equal(n.number, 5);
reply(n.number * 10);
},
print : function (n,reply) {
- assert.strictEqual(n[0],1);
- assert.strictEqual(n[1],2);
- assert.strictEqual(n[2],3);
- assert.strictEqual(n[3],n);
+ t.strictEqual(n[0],1);
+ t.strictEqual(n[1],2);
+ t.strictEqual(n[2],3);
+ t.strictEqual(n[3],n);
reply(n);
},
}).listen(port);
server.on('ready', function () {
dnode.connect(port, function (remote, conn) {
- assert.equal(conn.stream.remoteAddress, '127.0.0.1');
+ t.equal(conn.stream.remoteAddress, '127.0.0.1');
var args = [1,2,3]
args.push(args)
remote.print(args, function (m) {
- assert.eql(
- util.inspect(m),
- util.inspect(args)
- );
+ t.deepEqual(m, args);
conn.end();
server.close();
-
+ t.end();
});
});
});
-};
+});

0 comments on commit de1ab08

Please sign in to comment.