]> Sergey Matveev's repositories - path-extractor.git/commitdiff
Add fix for lines having more text with ackmate
authorEdgar HIPP <hipp.edg@gmail.com>
Sat, 16 Jan 2016 06:50:05 +0000 (07:50 +0100)
committerEdgar HIPP <hipp.edg@gmail.com>
Sat, 16 Jan 2016 06:50:05 +0000 (07:50 +0100)
extractor.go
pe_test.go

index e05ad4b93b50730c149315f98b68ec5655ba9fa7..2f764aa56183f02ddf6868fce4f23b87468297c3 100644 (file)
@@ -59,7 +59,7 @@ func GetAllMatches(input string, format string) []string {
 }
 
 func getCursorPosition(input string) string {
-       r := regexp.MustCompile("^(:[0-9]+(:[0-9]+)?)$")
+       r := regexp.MustCompile("^(:[0-9]+(:[0-9]+)?)")
        temp := [][]byte{}
        temp = r.FindSubmatch([]byte(input))
        if len(temp) <= 1 {
index 18297677e2aca6a578eacfcc967ae18fcc148add..c9726174fd46962e9859cbaf13deb1ce41ecf0f8 100644 (file)
@@ -198,4 +198,16 @@ func TestEverything(t *testing.T) {
        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)
+       }
 }