From 3b666abcc100c88081f3f3689d7f89dcbd12f2f5 Mon Sep 17 00:00:00 2001 From: "Iskander (Alex) Sharipov" Date: Wed, 28 Oct 2020 16:36:53 +0100 Subject: [PATCH] internal/phpgrep: print num of matches (#62) Fixes #61 Signed-off-by: Iskander Sharipov --- cmd/phpgrep/end2end_test.go | 2 ++ internal/phpgrep/program.go | 1 + 2 files changed, 3 insertions(+) diff --git a/cmd/phpgrep/end2end_test.go b/cmd/phpgrep/end2end_test.go index 4294aec..3d96cde 100644 --- a/cmd/phpgrep/end2end_test.go +++ b/cmd/phpgrep/end2end_test.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "os" "os/exec" "path/filepath" @@ -219,6 +220,7 @@ func TestEnd2End(t *testing.T) { } have := strings.Split(strings.TrimSpace(string(out)), "\n") want := test.matches + want = append(want, fmt.Sprintf("found %d matches", len(test.matches))) if diff := cmp.Diff(want, have); diff != "" { t.Errorf("output mismatch (+have -want):\n%s", diff) } diff --git a/internal/phpgrep/program.go b/internal/phpgrep/program.go index ee66983..906109d 100644 --- a/internal/phpgrep/program.go +++ b/internal/phpgrep/program.go @@ -188,6 +188,7 @@ func (p *program) printMatches() error { } } } + log.Printf("found %d matches", printed) return nil }