Skip to content

Commit 978c1f5

Browse files
committed
add register unit test
1 parent 77f1aac commit 978c1f5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/path_matcher_utility_test.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,21 @@ TEST_F(PathMatcherUtilityTest, RegisterAdditionalBindings) {
215215
ASSERT_FALSE(PathMatcherUtility::RegisterByHttpRule(pmb, http_rule, {"key"},
216216
&method2_));
217217
}
218+
219+
TEST_F(PathMatcherUtilityTest, RegisterRootPath) {
220+
HttpRule http_rule;
221+
http_rule.set_get("/");
222+
http_rule.set_body("body");
223+
EXPECT_CALL(pmb,
224+
Register(Eq("GET"), Eq("/"), Eq("body"),
225+
Eq(std::unordered_set<std::string>()), Eq(&method1_)))
226+
.WillOnce(Return(true));
227+
ASSERT_TRUE(
228+
PathMatcherUtility::RegisterByHttpRule(pmb, http_rule, &method1_));
229+
EXPECT_CALL(
230+
pmb, Register(Eq("GET"), Eq("/"), Eq("body"),
231+
Eq(std::unordered_set<std::string>{"key"}), Eq(&method2_)))
232+
.WillOnce(Return(false));
233+
ASSERT_FALSE(PathMatcherUtility::RegisterByHttpRule(pmb, http_rule, {"key"},
234+
&method2_));
235+
}

0 commit comments

Comments
 (0)