From a3d42517c735ba167571bda24be7337e7055512e Mon Sep 17 00:00:00 2001 From: Edgar HIPP Date: Sat, 16 Jan 2016 07:50:05 +0100 Subject: [PATCH] Add fix for lines having more text with ackmate --- extractor.go | 2 +- pe_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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) + } } -- 2.44.0