1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

making an attempt to improve the test suite

This commit is contained in:
Benjamin Coe
2015-07-11 16:14:42 -07:00
parent b92a62d643
commit d30e80abbe
8 changed files with 92 additions and 35 deletions

35
test/queue-test.js Normal file
View File

@@ -0,0 +1,35 @@
var assert = require("assert");
var Queue = require('../lib/queue');
module.exports = function (tests, next) {
var q = new Queue();
tests.push = function () {
q.push('a');
q.push(3);
assert.equal(q.length, 2);
return next();
}
tests.shift = function () {
assert.equal(q.shift(), 'a');
return next();
}
tests.forEach = function () {
q.forEach(function (v) {
assert.equal(v, 3);
});
return next();
}
tests.forEachWithScope = function () {
q.forEach(function (v) {
assert.equal(this.foo, 'bar');
assert.equal(v, 3);
}, {foo: 'bar'});
return next();
}
}

4
test/run.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
node ./test/test.js false hiredis
node ./test/test.js false javascript

12
test/test-unref.js Normal file
View File

@@ -0,0 +1,12 @@
var redis = require("../")
//redis.debug_mode = true
var PORT = process.argv[2] || 6379;
var HOST = process.argv[3] || '127.0.0.1';
var c = redis.createClient(PORT, HOST)
c.unref()
c.info(function (err, reply) {
if (err) process.exit(-1)
if (!reply.length) process.exit(-1)
process.stdout.write(reply.length.toString())
})

2312
test/test.js Normal file

File diff suppressed because it is too large Load Diff