continue
}
- if isEmail(candidatePath) || isDate(candidatePath) || isVersion(candidatePath) || isGitRange(candidatePath) || isGitInstruction(candidatePath) || endsWithInvalidString(candidatePath) || containsInvalidString(candidatePath) || len(candidatePath) <= 2 {
+ if isEmail(candidatePath) || isDate(candidatePath) || isVersion(candidatePath) || isGitRange(candidatePath) || isGitInstruction(candidatePath) || startsWithInvalidString(candidatePath) || endsWithInvalidString(candidatePath) || containsInvalidString(candidatePath) || len(candidatePath) <= 2 {
continue
}
if isGitPath(candidatePath) {
t.Errorf("Doesnt match multiple extensions", output)
}
+ output = GetAllMatches("[Error/foobar]", "")
+ if len(output) == 1 {
+ t.Errorf("Matches error", output)
+ }
+
+ output = GetAllMatches("[Object.foo]", "")
+ if len(output) == 1 {
+ t.Errorf("Matches Object.foo", output)
+ }
+
output = GetAllMatches("(user.js)", "")
if len(output) != 1 {
t.Errorf("Doesnt match surrounded by parens", output)
return r.Match([]byte(input))
}
+func startsWithInvalidString(input string) bool {
+ invalidBeginnings := []string{"Error/", "Object.", "Array."}
+ for _, s := range invalidBeginnings {
+ if strings.Index(input, s) == 0 {
+ return true
+ }
+ }
+ return false
+}
+
func endsWithInvalidString(input string) bool {
invalidEndings := []string{"."}
for _, s := range invalidEndings {