liumh8 commented on a change in pull request #1128:
URL: https://github.com/apache/incubator-brpc/pull/1128#discussion_r432825430
##########
File path: test/brpc_redis_unittest.cpp
##########
@@ -565,15 +565,15 @@ std::string GetCompleteCommand(const std::vector<const
char*>& commands) {
TEST_F(RedisTest, command_parser) {
brpc::RedisCommandParser parser;
butil::IOBuf buf;
- std::vector<const char*> command_out;
+ std::vector<butil::StringPiece> command_out;
butil::Arena arena;
{
// parse from whole command
std::string command = "set abc edc";
ASSERT_TRUE(brpc::RedisCommandNoFormat(&buf, command.c_str()).ok());
ASSERT_EQ(brpc::PARSE_OK, parser.Consume(buf, &command_out, &arena));
ASSERT_TRUE(buf.empty());
- ASSERT_STREQ(command.c_str(), GetCompleteCommand(command_out).c_str());
+ ASSERT_EQ(command, GetCompleteCommand(command_out));
Review comment:
如果中间包含'\0'就不能完全得比较了
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]