1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-05 00:59:04 +02:00

refactor: use require on all tests (#1839)

* refactor: use require on all tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* refactor: use require on all tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2020-10-06 09:48:04 -03:00
committed by GitHub
parent 2c487bc478
commit 979f8632b7
48 changed files with 1074 additions and 1106 deletions

View File

@ -6,18 +6,18 @@ import (
"github.com/goreleaser/goreleaser/internal/git"
"github.com/goreleaser/goreleaser/internal/testlib"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGit(t *testing.T) {
out, err := git.Run("status")
assert.NoError(t, err)
assert.NotEmpty(t, out)
require.NoError(t, err)
require.NotEmpty(t, out)
out, err = git.Run("command-that-dont-exist")
assert.Error(t, err)
assert.Empty(t, out)
assert.Equal(
require.Error(t, err)
require.Empty(t, out)
require.Equal(
t,
"git: 'command-that-dont-exist' is not a git command. See 'git --help'.\n",
err.Error(),
@ -36,26 +36,26 @@ func TestGitWarning(t *testing.T) {
testlib.GitTag(t, "1.2.3")
out, err := git.Run("describe", "--tags", "--abbrev=0", "tags/1.2.3^")
assert.NoError(t, err)
assert.Equal(t, "1.2.2\n", out)
require.NoError(t, err)
require.Equal(t, "1.2.2\n", out)
}
func TestRepo(t *testing.T) {
assert.True(t, git.IsRepo(), "goreleaser folder should be a git repo")
require.True(t, git.IsRepo(), "goreleaser folder should be a git repo")
assert.NoError(t, os.Chdir(os.TempDir()))
assert.False(t, git.IsRepo(), os.TempDir()+" folder should be a git repo")
require.NoError(t, os.Chdir(os.TempDir()))
require.False(t, git.IsRepo(), os.TempDir()+" folder should be a git repo")
}
func TestClean(t *testing.T) {
out, err := git.Clean("asdasd 'ssadas'\nadasd", nil)
assert.NoError(t, err)
assert.Equal(t, "asdasd ssadas", out)
require.NoError(t, err)
require.Equal(t, "asdasd ssadas", out)
out, err = git.Clean(git.Run("command-that-dont-exist"))
assert.Error(t, err)
assert.Empty(t, out)
assert.Equal(
require.Error(t, err)
require.Empty(t, out)
require.Equal(
t,
"git: 'command-that-dont-exist' is not a git command. See 'git --help'.",
err.Error(),