From ca9ce226938c20f29cf528581fae070be7e7f98c Mon Sep 17 00:00:00 2001 From: Anthony HAMON Date: Mon, 27 Aug 2018 22:40:15 +0200 Subject: [PATCH] use assert in tests, rename testing method --- pkg/commands/git_test.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 9c6a17b2c..6deeee073 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -2,11 +2,11 @@ package commands import ( "io/ioutil" - "strings" "testing" "github.com/jesseduffield/lazygit/pkg/test" "github.com/sirupsen/logrus" + "github.com/stretchr/testify/assert" ) func newDummyLog() *logrus.Entry { @@ -22,11 +22,11 @@ func newDummyGitCommand() *GitCommand { } } -func TestDiff(t *testing.T) { - gitCommand := newDummyGitCommand() - if err := test.GenerateRepo("lots_of_diffs.sh"); err != nil { - t.Error(err.Error()) } +func TestGitCommandDiff(t *testing.T) { + gitCommand := newDummyGitCommand() + assert.NoError(t, test.GenerateRepo("lots_of_diffs.sh")) + files := []File{ { Name: "deleted_staged", @@ -110,10 +110,8 @@ func TestDiff(t *testing.T) { DisplayString: "?? master", }, } + for _, file := range files { - content := gitCommand.Diff(file) - if strings.Contains(content, "error") { - t.Error("Error: diff test failed. File: " + file.Name + ", " + content) - } + assert.NotContains(t, gitCommand.Diff(file), "error") } }