You've already forked node-redis
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:
35
test/queue-test.js
Normal file
35
test/queue-test.js
Normal 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
4
test/run.sh
Executable 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
12
test/test-unref.js
Normal 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
2312
test/test.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user