summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorAnthony HAMON <anthony.hamon@iadvize.com>2018-08-27 22:40:15 +0200
committerAnthony HAMON <hamon.anth@gmail.com>2018-08-29 12:03:32 +0200
commitca9ce226938c20f29cf528581fae070be7e7f98c (patch)
tree7f1eb76fd26d26269899db462f84873d3342157a /pkg
parentcff1dee6dcb303e789b804bbe270a0032f0b76a7 (diff)
use assert in tests, rename testing method
Diffstat (limited to 'pkg')
-rw-r--r--pkg/commands/git_test.go16
1 files 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")
}
}