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

Merge branch 'master' of https://github.com/nick-apperson/node_redis into nick-apperson-master

This commit is contained in:
Bryce Baril
2014-05-18 15:31:04 -07:00
2 changed files with 16 additions and 1 deletions

View File

@@ -590,7 +590,7 @@ function reply_to_object(reply) {
} }
for (j = 0, jl = reply.length; j < jl; j += 2) { for (j = 0, jl = reply.length; j < jl; j += 2) {
key = reply[j].toString(); key = reply[j].toString('binary');
val = reply[j + 1]; val = reply[j + 1];
obj[key] = val; obj[key] = val;
} }

15
test.js
View File

@@ -1404,6 +1404,21 @@ tests.HGETALL = function () {
}); });
}; };
tests.HGETALL_2 = function () {
var name = "HGETALL (Binary client)";
bclient.hmset(["bhosts", "mjr", "1", "another", "23", "home", "1234", new Buffer([0xAA, 0xBB, 0x00, 0xF0]), new Buffer([0xCC, 0xDD, 0x00, 0xF0])], require_string("OK", name));
bclient.HGETALL(["bhosts"], function (err, obj) {
assert.strictEqual(null, err, name + " result sent back unexpected error: " + err);
assert.strictEqual(4, Object.keys(obj).length, name);
assert.strictEqual("1", obj.mjr.toString(), name);
assert.strictEqual("23", obj.another.toString(), name);
assert.strictEqual("1234", obj.home.toString(), name);
assert.strictEqual((new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary'), Object.keys(obj)[3], name);
assert.strictEqual((new Buffer([0xCC, 0xDD, 0x00, 0xF0])).toString('binary'), obj[(new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary')].toString('binary'), name);
next(name);
});
};
tests.HGETALL_MESSAGE = function () { tests.HGETALL_MESSAGE = function () {
var name = "HGETALL_MESSAGE"; var name = "HGETALL_MESSAGE";
client.hmset("msg_test", {message: "hello"}, require_string("OK", name)); client.hmset("msg_test", {message: "hello"}, require_string("OK", name));