Skip to content

Commit

Permalink
Add test for #37
Browse files Browse the repository at this point in the history
  • Loading branch information
basiliscos committed Dec 7, 2019
1 parent 7ab27ed commit 395830c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions t/05-protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,13 @@ TEST_CASE("serialize + dynamic_string_buffer", "[protocol]") {
std::string copy(std::begin(buff_backend), std::begin(buff_backend) + buff.size());
REQUIRE(copy == expected);
}

TEST_CASE("issue#37, empty command", "[protocol]") {
boost::asio::streambuf buff;
r::single_command_t cmd("HSET", "key", "value1", "", "value2", "");
r::Protocol::serialize(buff, cmd);
std::string expected("*6\r\n$4\r\nHSET\r\n$3\r\nkey\r\n$6\r\nvalue1\r\n$0\r\n\r\n$6\r\nvalue2\r\n$0\r\n\r\n");
char data[128] = {0};
asio::buffer_copy(asio::buffer(data), asio::buffer(buff.data(), buff.size()));
REQUIRE(data == expected);
}

0 comments on commit 395830c

Please sign in to comment.