summaryrefslogtreecommitdiff
path: root/cmds/incident_helper/tests/ih_util_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/incident_helper/tests/ih_util_test.cpp')
-rw-r--r--cmds/incident_helper/tests/ih_util_test.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/cmds/incident_helper/tests/ih_util_test.cpp b/cmds/incident_helper/tests/ih_util_test.cpp
index 7b8cf52c8bee..efe714d98b18 100644
--- a/cmds/incident_helper/tests/ih_util_test.cpp
+++ b/cmds/incident_helper/tests/ih_util_test.cpp
@@ -60,6 +60,9 @@ TEST(IhUtilTest, ParseRecord) {
result = parseRecord("123,456,78_9", ",");
expected = { "123", "456", "78_9" };
EXPECT_EQ(expected, result);
+
+ result = parseRecord("", " ");
+ EXPECT_TRUE(result.empty());
}
TEST(IhUtilTest, ParseRecordByColumns) {
@@ -133,6 +136,22 @@ TEST(IhUtilTest, stripSuffix) {
EXPECT_THAT(data4, StrEq(" 243%abc"));
}
+TEST(IhUtilTest, behead) {
+ string testcase1 = "81002 dropbox_file_copy (a)(b)";
+ EXPECT_THAT(behead(&testcase1, ' '), StrEq("81002"));
+ EXPECT_THAT(behead(&testcase1, ' '), StrEq("dropbox_file_copy"));
+ EXPECT_THAT(testcase1, "(a)(b)");
+
+ string testcase2 = "adbce,erwqr";
+ EXPECT_THAT(behead(&testcase2, ' '), StrEq("adbce,erwqr"));
+ EXPECT_THAT(testcase2, "");
+
+ string testcase3 = "first second";
+ EXPECT_THAT(behead(&testcase3, ' '), StrEq("first"));
+ EXPECT_THAT(behead(&testcase3, ' '), StrEq("second"));
+ EXPECT_THAT(testcase3, "");
+}
+
TEST(IhUtilTest, Reader) {
TemporaryFile tf;
ASSERT_NE(tf.fd, -1);