Skip to content

Commit

Permalink
Use assert in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sosedoff committed Mar 2, 2023
1 parent 77275cb commit e722c38
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package gitkit
import (
"bytes"
"testing"

"github.com/stretchr/testify/assert"
)

func Test_subCommand(t *testing.T) {
Expand Down Expand Up @@ -50,13 +52,8 @@ func Test_packLine(t *testing.T) {
w.Reset()
err := packLine(w, example)

if err != nil {
t.Errorf("Expected no error, got %v", err)
}

if w.String() != expected {
t.Errorf("Expected %s, got %s", expected, w.String())
}
assert.NoError(t, err)
assert.Equal(t, expected, w.String())
}
}

Expand All @@ -74,11 +71,7 @@ func Test_getNamespaceAndRepo(t *testing.T) {
for example, expected := range cases {
namespace, repo := getNamespaceAndRepo(example)

if namespace != expected[0] {
t.Errorf("Expected %v namespace, got: %v", expected[0], namespace)
}
if repo != expected[1] {
t.Errorf("Expected %v repo, got: %v", expected[1], repo)
}
assert.Equal(t, expected[0], namespace)
assert.Equal(t, expected[1], repo)
}
}

0 comments on commit e722c38

Please sign in to comment.