From: Edgar HIPP Date: Sat, 16 Jan 2016 06:50:05 +0000 (+0100) Subject: Add fix for lines having more text with ackmate X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a3d42517c735ba167571bda24be7337e7055512e;p=path-extractor.git Add fix for lines having more text with ackmate --- diff --git a/extractor.go b/extractor.go index e05ad4b..2f764aa 100644 --- a/extractor.go +++ b/extractor.go @@ -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 { diff --git a/pe_test.go b/pe_test.go index 1829767..c972617 100644 --- a/pe_test.go +++ b/pe_test.go @@ -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) + } }