add server pub/sub tests, fix pub/sub response (#27)
mini-redis server responses on PUB/SUB commands did not match real redis.
This commit is contained in:
@@ -143,7 +143,7 @@ impl Client {
|
||||
let response = self.read_response().await?;
|
||||
match response {
|
||||
Frame::Array(ref frame) => match frame.as_slice() {
|
||||
[subscribe, schannel]
|
||||
[subscribe, schannel, ..]
|
||||
if subscribe.to_string() == "subscribe"
|
||||
&& &schannel.to_string() == channel =>
|
||||
{
|
||||
@@ -235,7 +235,7 @@ impl Subscriber {
|
||||
let response = self.read_response().await?;
|
||||
match response {
|
||||
Frame::Array(ref frame) => match frame.as_slice() {
|
||||
[subscribe, schannel]
|
||||
[subscribe, schannel, ..]
|
||||
if &subscribe.to_string() == "subscribe"
|
||||
&& &schannel.to_string() == channel =>
|
||||
{
|
||||
@@ -277,7 +277,7 @@ impl Subscriber {
|
||||
let response = self.read_response().await?;
|
||||
match response {
|
||||
Frame::Array(ref frame) => match frame.as_slice() {
|
||||
[unsubscribe, uchannel] if &unsubscribe.to_string() == "unsubscribe" => {
|
||||
[unsubscribe, uchannel, ..] if &unsubscribe.to_string() == "unsubscribe" => {
|
||||
//unsubscribed channel should exist in the subscribed list at this point
|
||||
if self.subscribed_channels.remove(&uchannel.to_string()) == false {
|
||||
return Err(response.to_error());
|
||||
|
||||
Reference in New Issue
Block a user