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

added tests for HMSET using numeric key

This commit is contained in:
Alex Stokes
2013-11-21 11:44:33 -06:00
parent 2fbbe26127
commit 6634e5eeaf

16
test.js
View File

@@ -811,7 +811,7 @@ tests.HLEN = function () {
next(name); next(name);
}); });
}); });
} };
tests.HMSET_BUFFER_AND_ARRAY = function () { tests.HMSET_BUFFER_AND_ARRAY = function () {
// Saving a buffer and an array to the same key should not error // Saving a buffer and an array to the same key should not error
@@ -828,8 +828,7 @@ tests.HMSET_BUFFER_AND_ARRAY = function () {
// TODO - add test for HMSET with optional callbacks // TODO - add test for HMSET with optional callbacks
tests.HMGET = function () { tests.HMGET = function () {
var key1 = "test hash 1", key2 = "test hash 2", name = "HMGET"; var key1 = "test hash 1", key2 = "test hash 2", key3 = 123456789, name = "HMGET";
// redis-like hmset syntax // redis-like hmset syntax
client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value", require_string("OK", name)); client.HMSET(key1, "0123456789", "abcdefghij", "some manner of key", "a type of value", require_string("OK", name));
@@ -839,6 +838,12 @@ tests.HMGET = function () {
"some manner of key": "a type of value" "some manner of key": "a type of value"
}, require_string("OK", name)); }, require_string("OK", name));
// test for numeric key
client.HMSET(key3, {
"0123456789": "abcdefghij",
"some manner of key": "a type of value"
}, require_string("OK", name));
client.HMGET(key1, "0123456789", "some manner of key", function (err, reply) { client.HMGET(key1, "0123456789", "some manner of key", function (err, reply) {
assert.strictEqual("abcdefghij", reply[0].toString(), name); assert.strictEqual("abcdefghij", reply[0].toString(), name);
assert.strictEqual("a type of value", reply[1].toString(), name); assert.strictEqual("a type of value", reply[1].toString(), name);
@@ -849,6 +854,11 @@ tests.HMGET = function () {
assert.strictEqual("a type of value", reply[1].toString(), name); assert.strictEqual("a type of value", reply[1].toString(), name);
}); });
client.HMGET(key3, "0123456789", "some manner of key", function (err, reply) {
assert.strictEqual("abcdefghij", reply[0].toString(), name);
assert.strictEqual("a type of value", reply[1].toString(), name);
});
client.HMGET(key1, ["0123456789"], function (err, reply) { client.HMGET(key1, ["0123456789"], function (err, reply) {
assert.strictEqual("abcdefghij", reply[0], name); assert.strictEqual("abcdefghij", reply[0], name);
}); });