t.Errorf("Doesnt match files", output)
}
+ output = GetAllMatches("2.0G", "")
+ if len(output) != 0 {
+ t.Errorf("File size matches", output)
+ }
+
+ output = GetAllMatches("4.0K", "")
+ if len(output) != 0 {
+ t.Errorf("File size matches", output)
+ }
+
+ output = GetAllMatches("72K", "")
+ if len(output) != 0 {
+ t.Errorf("File size matches", output)
+ }
+
+ output = GetAllMatches("remotes/origin/master", "")
+ if len(output) != 0 {
+ t.Errorf("Git branch matches", output)
+ }
+
output = GetAllMatches("I have a cat.", "")
if len(output) != 0 {
t.Errorf("Matches sentence", output)
t.Errorf("Matches version number", output)
}
+ output = GetAllMatches("14.22.2", "")
+ if len(output) != 0 {
+ t.Errorf("Matches version number", output)
+ }
+
output = GetAllMatches("~/v1.2/js", "")
if len(output) != 1 {
t.Errorf("Should match path with version inside", output)
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)
if output[0] != "test.js:45:12" {
t.Errorf("Ackmate should output right line number", output)
}
+
+ output = GetAllMatches("test.js:45:12 foo bar", "ackmate")
+ if len(output) != 1 {
+ t.Errorf("Ackmate doesnt match", output)
+ }
+
+ if output[0] == "test.js" {
+ t.Errorf("Ackmate should not forget number", output)
+ }
+ if output[0] != "test.js:45:12" {
+ t.Errorf("Ackmate should output right line number", output)
+ }
}