Skip to content

Commit c091356

Browse files
author
Ruslan Nigmatullin
committed
wildcard test
1 parent f1871bc commit c091356

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/path_matcher_test.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,24 @@ TEST_F(PathMatcherTest, CustomVerbMatch4) {
553553
EXPECT_EQ(LookupNoBindings("GET", "/foo/other:verb/hello"), a);
554554
}
555555

556+
TEST_F(PathMatcherTest, CustomVerbMatch5) {
557+
MethodInfo* verb = AddGetPath("/{a=**}:verb");
558+
MethodInfo* non_verb = AddGetPath("/{a=**}");
559+
Build();
560+
Bindings bindings;
561+
EXPECT_EQ(Lookup("GET", "/some:verb/const:verb", &bindings), verb);
562+
EXPECT_EQ(bindings.size(), 1);
563+
EXPECT_EQ(bindings[0].value, "some:verb/const");
564+
bindings.clear();
565+
EXPECT_EQ(Lookup("GET", "/some:verb/const", &bindings), non_verb);
566+
EXPECT_EQ(bindings.size(), 1);
567+
EXPECT_EQ(bindings[0].value, "some:verb/const");
568+
bindings.clear();
569+
EXPECT_EQ(Lookup("GET", "/some:verb2/const:verb2", &bindings), non_verb);
570+
EXPECT_EQ(bindings.size(), 1);
571+
EXPECT_EQ(bindings[0].value, "some:verb2/const:verb2");
572+
}
573+
556574
TEST_F(PathMatcherTest, RejectPartialMatches) {
557575
MethodInfo* prefix_middle_suffix = AddGetPath("/prefix/middle/suffix");
558576
MethodInfo* prefix_middle = AddGetPath("/prefix/middle");

0 commit comments

Comments
 (0)