1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

test.js: early return if command not supported

This commit is contained in:
DTrejo
2013-02-23 22:41:53 -05:00
parent 837cec36b6
commit a02b0f57e4

31
test.js
View File

@@ -289,7 +289,11 @@ tests.MULTI_6 = function () {
tests.EVAL_1 = function () {
var name = "EVAL_1";
if (server_version_at_least(client, [2, 5, 0])) {
if (!server_version_at_least(client, [2, 5, 0])) {
console.log("Skipping " + name + " for old Redis server version < 2.5.x");
return next(name);
}
// test {EVAL - Lua integer -> Redis protocol type conversion}
client.eval("return 100.5", 0, require_number(100, name));
// test {EVAL - Lua string -> Redis protocol type conversion}
@@ -413,41 +417,36 @@ tests.EVAL_1 = function () {
next(name);
});
});
} else {
console.log("Skipping " + name + " because server version isn't new enough.");
next(name);
}
};
tests.SCRIPT_LOAD = function() {
if (server_version_at_least(bclient, [2, 5, 0])) {
var name = "SCRIPT_LOAD",
command = "return 1",
commandSha = crypto.createHash('sha1').update(command).digest('hex');
if (!server_version_at_least(client, [2, 6, 0])) {
console.log("Skipping " + name + " for old Redis server version < 2.6.x");
return next(name);
}
bclient.script("load", command, function(err, result) {
assert.strictEqual(result.toString(), commandSha);
next(name);
});
} else {
console.log("Skipping " + name + " because server version isn't new enough.");
next(name);
}
};
tests.WATCH_MULTI = function () {
var name = 'WATCH_MULTI', multi;
if (!server_version_at_least(client, [2, 2, 0])) {
console.log("Skipping " + name + " for old Redis server version < 2.2.x");
return next(name);
}
if (server_version_at_least(client, [2, 1, 0])) {
client.watch(name);
client.incr(name);
multi = client.multi();
multi.incr(name);
multi.exec(last(name, require_null(name)));
} else {
console.log("Skipping " + name + " because server version isn't new enough.");
next(name);
}
};
tests.detect_buffers = function () {
@@ -1517,7 +1516,7 @@ tests.MONITOR = function () {
var name = "MONITOR", responses = [], monitor_client;
if (!server_version_at_least(client, [2, 6, 0])) {
console.log("Skipping monitor for old Redis server version <= 2.6.x");
console.log("Skipping " + name + " for old Redis server version < 2.6.x");
return next(name);
}