Skip to content

Commit

Permalink
Add leading wildcard tests for Directive.
Browse files Browse the repository at this point in the history
  • Loading branch information
b4hand committed Feb 12, 2018
1 parent 1a295b5 commit dce83d9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test-directive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,33 @@ TEST(DirectiveTest, WildcardTest)
}
}

TEST(DirectiveTest, LeadingWildcard)
{
std::vector<std::string> examples = {
"/test",
"/a/test",
"/ab/test",
"/abc/test",
};
std::string directive("*/test");
Rep::Directive parsed(directive, true);
for (auto example : examples)
{
EXPECT_TRUE(parsed.match(example)) <<
example << " didn't match " << directive;
}

std::vector<std::string> antiexamples = {
"/tes",
"/est",
};
for (auto example : antiexamples)
{
EXPECT_FALSE(parsed.match(example)) <<
example << " matched " << directive;
}
}

TEST(DirectiveTest, MultipleWildcardTest)
{
std::vector<std::string> examples = {
Expand Down

0 comments on commit dce83d9

Please sign in to comment.