pubsub: Return integers for NUMSUB, not strings
Also adds test for numsub — due to tcl being tcl, it doesn't capture the "numberness" of the fix, but now we at least have one test case for numsub. Closes #1561
This commit is contained in:
parent
c7140a24d0
commit
09e3b6e97c
@ -358,7 +358,7 @@ void pubsubCommand(redisClient *c) {
|
||||
list *l = dictFetchValue(server.pubsub_channels,c->argv[j]);
|
||||
|
||||
addReplyBulk(c,c->argv[j]);
|
||||
addReplyBulkLongLong(c,l ? listLength(l) : 0);
|
||||
addReplyLongLong(c,l ? listLength(l) : 0);
|
||||
}
|
||||
} else if (!strcasecmp(c->argv[1]->ptr,"numpat") && c->argc == 2) {
|
||||
/* PUBSUB NUMPAT */
|
||||
|
@ -196,6 +196,10 @@ start_server {tags {"pubsub"}} {
|
||||
$rd1 close
|
||||
}
|
||||
|
||||
test "NUMSUB returns numbers, not strings (#1561)" {
|
||||
r pubsub numsub abc def
|
||||
} {abc 0 def 0}
|
||||
|
||||
test "Mix SUBSCRIBE and PSUBSCRIBE" {
|
||||
set rd1 [redis_deferring_client]
|
||||
assert_equal {1} [subscribe $rd1 {foo.bar}]
|
||||
|
Loading…
x
Reference in New Issue
Block a user