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

EVAL: allow parameters as an array. Close #368.

Signed-off-by: DTrejo <david.daniel.trejo@gmail.com>
This commit is contained in:
DTrejo
2013-02-23 22:04:46 -05:00
parent f3c298d088
commit 938c0526a0
3 changed files with 18 additions and 0 deletions

View File

@@ -309,6 +309,15 @@ tests.EVAL_1 = function () {
assert.strictEqual("d", res[3], name);
});
// test {EVAL - parameters in array format gives same result}
client.eval(["return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d"], function (err, res) {
assert.strictEqual(4, res.length, name);
assert.strictEqual("a", res[0], name);
assert.strictEqual("b", res[1], name);
assert.strictEqual("c", res[2], name);
assert.strictEqual("d", res[3], name);
});
// prepare sha sum for evalsha cache test
var source = "return redis.call('get', 'sha test')",
sha = crypto.createHash('sha1').update(source).digest('hex');