diff --git a/test/test-directive.cpp b/test/test-directive.cpp index f94b24d..3de471e 100644 --- a/test/test-directive.cpp +++ b/test/test-directive.cpp @@ -70,6 +70,33 @@ TEST(DirectiveTest, WildcardTest) } } +TEST(DirectiveTest, LeadingWildcard) +{ + std::vector 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 antiexamples = { + "/tes", + "/est", + }; + for (auto example : antiexamples) + { + EXPECT_FALSE(parsed.match(example)) << + example << " matched " << directive; + } +} + TEST(DirectiveTest, MultipleWildcardTest) { std::vector examples = {