Refine the parsing of response status line; add UT for utility.

This commit is contained in:
Chunting Gu
2019-05-31 13:43:44 +08:00
parent 78743e6a55
commit 2035c1f552
10 changed files with 81 additions and 21 deletions
+1
View File
@@ -5,6 +5,7 @@ set(UT_SRCS
request_parser_unittest.cc
rest_service_manager_unittest.cc
url_unittest.cc
utility_unittest.cc
)
set(UT_TARGET_NAME webcc_unittest)
+16
View File
@@ -0,0 +1,16 @@
#include "gtest/gtest.h"
#include "webcc/utility.h"
TEST(UtilityTest, SplitKV) {
const std::string str = "Connection: Keep-Alive";
std::string key;
std::string value;
bool ok = webcc::SplitKV(str, ':', &key, &value);
EXPECT_EQ(true, ok);
EXPECT_EQ("Connection", key);
EXPECT_EQ("Keep-Alive", value);
}