#include "third_party/liburlpattern/pattern.h"
#include <optional>
#include <string_view>
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/liburlpattern/parse.h"
namespace {
absl::StatusOr<std::string> PassThrough(std::string_view input) { … }
}
namespace liburlpattern {
void RunRegexTest(std::string_view input,
std::string_view expected_regex,
std::vector<std::string> expected_name_list,
Options options = Options()) { … }
TEST(PatternRegexTest, Fixed) { … }
TEST(PatternRegexTest, FixedWithModifier) { … }
TEST(PatternRegexTest, Name) { … }
TEST(PatternRegexTest, NameWithUnicode) { … }
TEST(PatternRegexTest, NameWithOptionalModifier) { … }
TEST(PatternRegexTest, NameWithZeroOrMoreModifier) { … }
TEST(PatternRegexTest, NameWithOneOrMoreModifier) { … }
TEST(PatternRegexTest, NameWithPrefix) { … }
TEST(PatternRegexTest, NameWithPrefixAndOptionalModifier) { … }
TEST(PatternRegexTest, NameWithPrefixAndOneOrMoreModifier) { … }
TEST(PatternRegexTest, NameWithPrefixAndZeroOrMoreModifier) { … }
TEST(PatternRegexTest, Regex) { … }
TEST(PatternRegexTest, RegexFullWildcard) { … }
TEST(PatternRegexTest, Wildcard) { … }
TEST(PatternRegexTest, RegexWithOptionalModifier) { … }
TEST(PatternRegexTest, WildcardWithOptionalModifier) { … }
TEST(PatternRegexTest, RegexWithPrefix) { … }
TEST(PatternRegexTest, WildcardWithPrefix) { … }
TEST(PatternRegexTest, RegexWithPrefixAndOptionalModifier) { … }
TEST(PatternRegexTest, WildcardWithPrefixAndOptionalModifier) { … }
TEST(PatternRegexTest, RegexWithPrefixAndOneOrMoreModifier) { … }
TEST(PatternRegexTest, WildcardWithPrefixAndOneOrMoreModifier) { … }
TEST(PatternRegexTest, RegexWithPrefixAndZeroOrMoreModifier) { … }
TEST(PatternRegexTest, WildcardWithPrefixAndZeroOrMoreModifier) { … }
TEST(PatternRegexTest, NameWithCustomRegex) { … }
TEST(PatternRegexTest, ManyGroups) { … }
TEST(PatternRegexTest, StrictNameWithPrefixAndOneOrMoreModifier) { … }
TEST(PatternRegexTest, NoEndNameWithPrefixAndOneOrMoreModifier) { … }
TEST(PatternRegexTest, NoEndFixedWithTrailingDelimiter) { … }
TEST(PatternRegexTest, StrictNoEndFixedWithTrailingDelimiter) { … }
TEST(PatternRegexTest, StrictNoEndFixedWithoutTrailingDelimiter) { … }
TEST(PatternRegexTest, NoStartNameWithPrefixAndOneOrMoreModifier) { … }
TEST(PatternRegexTest, EndsWithNameWithPrefixAndOneOrMoreModifier) { … }
TEST(PatternRegexTest, EndsWithNoEndNameWithPrefixAndOneOrMoreModifier) { … }
void RunPatternStringTest(std::string_view input,
std::string_view expected_pattern_string) { … }
TEST(PatternStringTest, Fixed) { … }
TEST(PatternStringTest, Group) { … }
TEST(PatternStringTest, GroupWithRegexp) { … }
TEST(PatternStringTest, GroupWithPrefixAndRegexp) { … }
TEST(PatternStringTest, GroupWithDefaultPrefixAndRegexp) { … }
TEST(PatternStringTest, GroupWithRegexpAndSuffix) { … }
TEST(PatternStringTest, GroupWithDefaultPrefixRegexpAndSuffix) { … }
TEST(PatternStringTest, GroupWithQuestionModifier) { … }
TEST(PatternStringTest, GroupWithStarModifier) { … }
TEST(PatternStringTest, GroupWithPlusModifier) { … }
TEST(PatternStringTest, NamedGroup) { … }
TEST(PatternStringTest, SegmentWildcardWithoutName) { … }
TEST(PatternStringTest, NamedGroupWithRegexp) { … }
TEST(PatternStringTest, NamedGroupWithEquivalentRegexp) { … }
TEST(PatternStringTest, NamedGroupWithWildcardEquivalentRegexp) { … }
TEST(PatternStringTest, NamedGroupWithQuestionModifier) { … }
TEST(PatternStringTest, NamedGroupWithStarModifier) { … }
TEST(PatternStringTest, NamedGroupWithPlusModifier) { … }
TEST(PatternStringTest, Regexp) { … }
TEST(PatternStringTest, RegexpWithQuestionModifier) { … }
TEST(PatternStringTest, RegexpWithStarModifier) { … }
TEST(PatternStringTest, RegexpWithPlusModifier) { … }
TEST(PatternStringTest, Wildcard) { … }
TEST(PatternStringTest, RegexpWildcardEquivalent) { … }
TEST(PatternStringTest, RegexpEscapedNonPatternChar) { … }
TEST(PatternStringTest, RegexpEscapedPatternChar) { … }
TEST(PatternStringTest, RegexpEscapedPatternCharInPrefix) { … }
TEST(PatternStringTest, RegexpEscapedPatternCharInSuffix) { … }
TEST(PatternStringTest, RegexpFollowedByWildcard) { … }
TEST(PatternStringTest, RegexpWithOptionalModifierFollowedByWildcard) { … }
TEST(PatternStringTest, RegexpWithSuffixModifierFollowedByWildcard) { … }
TEST(PatternStringTest, NamedGroupInGroupingFollowedByWildcard) { … }
TEST(PatternStringTest, NamedGroupInGroupingFollowedByRegexp) { … }
TEST(PatternStringTest, NamedGroupInGroupingFollowedByWildcardInGrouping) { … }
TEST(PatternStringTest, NamedGroupInGroupingFollowedByWildcardWithSuffix) { … }
TEST(PatternStringTest, NamedGroupInGroupingFollowedByWildcardWithPrefix) { … }
TEST(PatternStringTest, NamedGroupInGroupingFollowedByWildcardWithCustomName) { … }
TEST(PatternStringTest,
NamedGroupInGroupingWithOptionalModifierFollowedByWildcard) { … }
TEST(PatternStringTest, NamedGroupWithEscapedValidNameSuffix) { … }
TEST(PatternStringTest, NamedGroupWithEscapedInvalidNameSuffix) { … }
TEST(PatternStringTest, NamedGroupInGroupingFollowedByValidNameText) { … }
TEST(PatternStringTest, NamedGroupFollowedByEscapedValidNameText) { … }
TEST(PatternStringTest, NamedGroupWithRegexpFollowedByValidNameText) { … }
TEST(PatternStringTest, NamedGroupFollowedByEmptyGroupAndWildcard) { … }
TEST(PatternStringTest, NamedGroupFollowedByEmptyGroupAndValidNameText) { … }
TEST(PatternStringTest,
NamedGroupFollowedByEmptyGroupWithOptionalModifierAndValidNameText) { … }
TEST(PatternStringTest, NamedGroupWithRegexpFollowedByWildcard) { … }
TEST(PatternStringTest, NamedGroupWithRegexpAndValidNameSuffix) { … }
TEST(PatternStringTest, WildcardSlashAndWildcard) { … }
TEST(PatternStringTest, WildcardEscapedSlashAndWildcard) { … }
TEST(PatternStringTest, WildcardSlashAndWildcardInGrouping) { … }
TEST(PatternStringTest, WildcardSlashSlashAndWildcard) { … }
TEST(
PatternStringTest,
WildcardFollowedByEmptyGroupWithZeroOrMoreModifierAndWildcardWithOptionalModifier) { … }
TEST(PatternStringTest, CaseFromFuzzer) { … }
struct DirectMatchCase { … };
void RunDirectMatchTest(std::string_view input,
std::vector<DirectMatchCase> case_list) { … }
void RunDirectMatchUnsupportedTest(std::string_view input,
Options options = { … }
TEST(PatternDirectMatch, FullWildcardSupported) { … }
TEST(PatternDirectMatch, FullWildcardInGroupSupported) { … }
TEST(PatternDirectMatch, FullWildcardUsingRegexSupported) { … }
TEST(PatternDirectMatch, FullWildcardAndOptionalModifierSupported) { … }
TEST(PatternDirectMatch, FullWildcardAndOneOrMoreModifierSupported) { … }
TEST(PatternDirectMatch, FullWildcardAndZeroOrMoreModifierSupported) { … }
TEST(PatternDirectMatch, FullWildcardWithNameUsingRegexSupported) { … }
TEST(PatternDirectMatch, OptionsFalseStartUnsupported) { … }
TEST(PatternDirectMatch, OptionsFalseEndUnsupported) { … }
TEST(PatternDirectMatch, OptionsFalseStrictUnsupported) { … }
TEST(PatternDirectMatch, OptionsFalseSensitiveUnsupported) { … }
TEST(PatternDirectMatch, FullWildcardWithPrefixUnsupported) { … }
TEST(PatternDirectMatch, FullWildcardInGroupWithPrefixUnsupported) { … }
TEST(PatternDirectMatch, FullWildcardInGroupWithSuffixUnsupported) { … }
TEST(PatternDirectMatch, EmptyPatternSupported) { … }
TEST(PatternDirectMatch, FixedTextSupported) { … }
TEST(PatternDirectMatch, FixedTextInGroupSupported) { … }
TEST(PatternDirectMatch, FixedTextInGroupWithOptionalModifierUnsupported) { … }
TEST(PatternDirectMatch, FixedTextInGroupWithZeroOrMoreModifierUnsupported) { … }
TEST(PatternDirectMatch, FixedTextInGroupWithOneOrMoreModifierUnsupported) { … }
TEST(PatternDirectMatch, FixedTextAndFullWildcardUnsupported) { … }
TEST(PatternDirectMatch, NamedGroupUnsupported) { … }
TEST(PatternDirectMatch, RegexUnsupported) { … }
}