mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
commit
2276822397
@ -3,12 +3,12 @@ package goreleaserlib
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/goreleaser/goreleaser/config"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/stretchr/testify/assert"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
@ -176,30 +176,17 @@ func setup(t *testing.T) (current string, back func()) {
|
||||
previous, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
assert.NoError(os.Chdir(folder))
|
||||
var gitCmds = [][]string{
|
||||
{"init"},
|
||||
{"config", "commit.gpgSign", "false"},
|
||||
{"add", "-A"},
|
||||
{"commit", "--allow-empty", "-m", "asdf"},
|
||||
{"tag", "v0.0.1"},
|
||||
{"commit", "--allow-empty", "-m", "asas89d"},
|
||||
{"commit", "--allow-empty", "-m", "assssf"},
|
||||
{"commit", "--allow-empty", "-m", "assd"},
|
||||
{"tag", "v0.0.2"},
|
||||
{"remote", "add", "origin", "git@github.com:goreleaser/fake.git"},
|
||||
}
|
||||
createGoreleaserYaml(t)
|
||||
createMainGo(t)
|
||||
for _, cmd := range gitCmds {
|
||||
var args = []string{
|
||||
"-c",
|
||||
"user.name='GoReleaser'",
|
||||
"-c",
|
||||
"user.email='test@goreleaser.github.com'",
|
||||
}
|
||||
args = append(args, cmd...)
|
||||
assert.NoError(exec.Command("git", args...).Run())
|
||||
}
|
||||
testlib.GitInit(t)
|
||||
testlib.GitAdd(t)
|
||||
testlib.GitCommit(t, "asdf")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
testlib.GitCommit(t, "asas89d")
|
||||
testlib.GitCommit(t, "assssf")
|
||||
testlib.GitCommit(t, "assd")
|
||||
testlib.GitTag(t, "v0.0.2")
|
||||
testlib.GitRemoteAdd(t, "git@github.com:goreleaser/fake.git")
|
||||
return folder, func() {
|
||||
assert.NoError(os.Chdir(previous))
|
||||
}
|
||||
|
69
internal/testlib/git.go
Normal file
69
internal/testlib/git.go
Normal file
@ -0,0 +1,69 @@
|
||||
package testlib
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// GitInit inits a new git project
|
||||
func GitInit(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
out, err := git("init")
|
||||
assert.NoError(err)
|
||||
assert.Contains(out, "Initialized empty Git repository")
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
// GitRemoteAdd adds the given url as remote
|
||||
func GitRemoteAdd(t *testing.T, url string) {
|
||||
var assert = assert.New(t)
|
||||
out, err := fakeGit("remote", "add", "origin", url)
|
||||
assert.NoError(err)
|
||||
assert.Empty(out)
|
||||
}
|
||||
|
||||
// GitCommit creates a git commits
|
||||
func GitCommit(t *testing.T, msg string) {
|
||||
var assert = assert.New(t)
|
||||
out, err := fakeGit("commit", "--allow-empty", "-m", msg)
|
||||
assert.NoError(err)
|
||||
assert.Contains(out, "master", msg)
|
||||
}
|
||||
|
||||
// GitTag creates a git tag
|
||||
func GitTag(t *testing.T, tag string) {
|
||||
var assert = assert.New(t)
|
||||
out, err := fakeGit("tag", tag)
|
||||
assert.NoError(err)
|
||||
assert.Empty(out)
|
||||
}
|
||||
|
||||
// GitAdd adds all files to stage
|
||||
func GitAdd(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
out, err := git("add", "-A")
|
||||
assert.NoError(err)
|
||||
assert.Empty(out)
|
||||
}
|
||||
|
||||
func fakeGit(args ...string) (string, error) {
|
||||
var allArgs = []string{
|
||||
"-c", "user.name='GoReleaser'",
|
||||
"-c", "user.email='test@goreleaser.github.com'",
|
||||
"-c", "commit.gpgSign=false",
|
||||
}
|
||||
allArgs = append(allArgs, args...)
|
||||
return git(allArgs...)
|
||||
}
|
||||
|
||||
func git(args ...string) (output string, err error) {
|
||||
var cmd = exec.Command("git", args...)
|
||||
bts, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", errors.New(string(bts))
|
||||
}
|
||||
return string(bts), err
|
||||
}
|
15
internal/testlib/git_test.go
Normal file
15
internal/testlib/git_test.go
Normal file
@ -0,0 +1,15 @@
|
||||
package testlib
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGit(t *testing.T) {
|
||||
_, back := Mktmp(t)
|
||||
defer back()
|
||||
GitInit(t)
|
||||
GitAdd(t)
|
||||
GitCommit(t, "commit1")
|
||||
GitRemoteAdd(t, "git@github.com:goreleaser/nope.git")
|
||||
GitTag(t, "v1.0.0")
|
||||
}
|
24
internal/testlib/mktemp.go
Normal file
24
internal/testlib/mktemp.go
Normal file
@ -0,0 +1,24 @@
|
||||
// Package testlib contains test helpers for goreleaser tests.
|
||||
package testlib
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// Mktmp creates a new tempdir, cd into it and provides a back function that
|
||||
// cd into the previous directory.
|
||||
func Mktmp(t *testing.T) (folder string, back func()) {
|
||||
var assert = assert.New(t)
|
||||
folder, err := ioutil.TempDir("", "goreleasertest")
|
||||
assert.NoError(err)
|
||||
current, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
assert.NoError(os.Chdir(folder))
|
||||
return folder, func() {
|
||||
assert.NoError(os.Chdir(current))
|
||||
}
|
||||
}
|
20
internal/testlib/mktemp_test.go
Normal file
20
internal/testlib/mktemp_test.go
Normal file
@ -0,0 +1,20 @@
|
||||
package testlib
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMkTemp(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
current, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
folder, back := Mktmp(t)
|
||||
assert.NotEmpty(folder)
|
||||
back()
|
||||
newCurrent, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
assert.Equal(current, newCurrent)
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
package archive
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/goreleaser/goreleaser/config"
|
||||
"github.com/goreleaser/goreleaser/context"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@ -17,19 +17,13 @@ func TestDescription(t *testing.T) {
|
||||
|
||||
func TestRunPipe(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
folder, err := ioutil.TempDir("", "archivetest")
|
||||
assert.NoError(err)
|
||||
current, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
assert.NoError(os.Chdir(folder))
|
||||
defer func() {
|
||||
assert.NoError(os.Chdir(current))
|
||||
}()
|
||||
folder, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
var dist = filepath.Join(folder, "dist")
|
||||
assert.NoError(os.Mkdir(dist, 0755))
|
||||
assert.NoError(os.Mkdir(filepath.Join(dist, "mybin_darwin_amd64"), 0755))
|
||||
assert.NoError(os.Mkdir(filepath.Join(dist, "mybin_windows_amd64"), 0755))
|
||||
_, err = os.Create(filepath.Join(dist, "mybin_darwin_amd64", "mybin"))
|
||||
_, err := os.Create(filepath.Join(dist, "mybin_darwin_amd64", "mybin"))
|
||||
assert.NoError(err)
|
||||
_, err = os.Create(filepath.Join(dist, "mybin_windows_amd64", "mybin.exe"))
|
||||
assert.NoError(err)
|
||||
@ -63,19 +57,13 @@ func TestRunPipe(t *testing.T) {
|
||||
|
||||
func TestRunPipeBinary(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
folder, err := ioutil.TempDir("", "archivetest")
|
||||
assert.NoError(err)
|
||||
current, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
assert.NoError(os.Chdir(folder))
|
||||
defer func() {
|
||||
assert.NoError(os.Chdir(current))
|
||||
}()
|
||||
folder, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
var dist = filepath.Join(folder, "dist")
|
||||
assert.NoError(os.Mkdir(dist, 0755))
|
||||
assert.NoError(os.Mkdir(filepath.Join(dist, "mybin_darwin"), 0755))
|
||||
assert.NoError(os.Mkdir(filepath.Join(dist, "mybin_win"), 0755))
|
||||
_, err = os.Create(filepath.Join(dist, "mybin_darwin", "mybin"))
|
||||
_, err := os.Create(filepath.Join(dist, "mybin_darwin", "mybin"))
|
||||
assert.NoError(err)
|
||||
_, err = os.Create(filepath.Join(dist, "mybin_win", "mybin.exe"))
|
||||
assert.NoError(err)
|
||||
@ -132,14 +120,8 @@ func TestRunPipeInvalidGlob(t *testing.T) {
|
||||
|
||||
func TestRunPipeGlobFailsToAdd(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
folder, err := ioutil.TempDir("", "archivetest")
|
||||
assert.NoError(err)
|
||||
current, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
assert.NoError(os.Chdir(folder))
|
||||
defer func() {
|
||||
assert.NoError(os.Chdir(current))
|
||||
}()
|
||||
folder, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
assert.NoError(os.MkdirAll(filepath.Join(folder, "folder", "another"), 0755))
|
||||
|
||||
var ctx = &context.Context{
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/goreleaser/goreleaser/config"
|
||||
"github.com/goreleaser/goreleaser/context"
|
||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||
"github.com/goreleaser/goreleaser/pipeline/defaults"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@ -18,7 +19,7 @@ func TestDescription(t *testing.T) {
|
||||
|
||||
func TestNotAGitFolder(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
@ -28,11 +29,11 @@ func TestNotAGitFolder(t *testing.T) {
|
||||
|
||||
func TestSingleCommit(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "commit1")
|
||||
gitTag(t, "v0.0.1")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "commit1")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
}
|
||||
@ -42,9 +43,9 @@ func TestSingleCommit(t *testing.T) {
|
||||
|
||||
func TestNewRepository(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
testlib.GitInit(t)
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
}
|
||||
@ -53,10 +54,10 @@ func TestNewRepository(t *testing.T) {
|
||||
|
||||
func TestNoTagsSnapshot(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "first")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "first")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{
|
||||
Snapshot: config.Snapshot{
|
||||
@ -72,10 +73,10 @@ func TestNoTagsSnapshot(t *testing.T) {
|
||||
|
||||
func TestNoTagsSnapshotInvalidTemplate(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "first")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "first")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{
|
||||
Snapshot: config.Snapshot{
|
||||
@ -93,10 +94,10 @@ func TestNoTagsSnapshotInvalidTemplate(t *testing.T) {
|
||||
// to set the --snapshot flag otherwise an error is returned.
|
||||
func TestNoTagsNoSnapshot(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "first")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "first")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{
|
||||
Snapshot: config.Snapshot{
|
||||
@ -111,11 +112,11 @@ func TestNoTagsNoSnapshot(t *testing.T) {
|
||||
|
||||
func TestInvalidTagFormat(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "commit2")
|
||||
gitTag(t, "sadasd")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "commit2")
|
||||
testlib.GitTag(t, "sadasd")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: true,
|
||||
@ -126,14 +127,14 @@ func TestInvalidTagFormat(t *testing.T) {
|
||||
|
||||
func TestDirty(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
folder, back := createAndChdir(t)
|
||||
folder, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
testlib.GitInit(t)
|
||||
dummy, err := os.Create(filepath.Join(folder, "dummy"))
|
||||
assert.NoError(err)
|
||||
gitAdd(t)
|
||||
gitCommit(t, "commit2")
|
||||
gitTag(t, "v0.0.1")
|
||||
testlib.GitAdd(t)
|
||||
testlib.GitCommit(t, "commit2")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
assert.NoError(ioutil.WriteFile(dummy.Name(), []byte("lorem ipsum"), 0644))
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
@ -146,12 +147,12 @@ func TestDirty(t *testing.T) {
|
||||
|
||||
func TestTagIsNotLastCommit(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "commit3")
|
||||
gitTag(t, "v0.0.1")
|
||||
gitCommit(t, "commit4")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "commit3")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
testlib.GitCommit(t, "commit4")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: true,
|
||||
@ -163,13 +164,13 @@ func TestTagIsNotLastCommit(t *testing.T) {
|
||||
|
||||
func TestValidState(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "commit3")
|
||||
gitTag(t, "v0.0.1")
|
||||
gitCommit(t, "commit4")
|
||||
gitTag(t, "v0.0.2")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "commit3")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
testlib.GitCommit(t, "commit4")
|
||||
testlib.GitTag(t, "v0.0.2")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: true,
|
||||
@ -182,13 +183,13 @@ func TestValidState(t *testing.T) {
|
||||
|
||||
func TestNoValidate(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitAdd(t)
|
||||
gitCommit(t, "commit5")
|
||||
gitTag(t, "v0.0.1")
|
||||
gitCommit(t, "commit6")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitAdd(t)
|
||||
testlib.GitCommit(t, "commit5")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
testlib.GitCommit(t, "commit6")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: false,
|
||||
@ -198,14 +199,14 @@ func TestNoValidate(t *testing.T) {
|
||||
|
||||
func TestChangelog(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "first")
|
||||
gitTag(t, "v0.0.1")
|
||||
gitCommit(t, "added feature 1")
|
||||
gitCommit(t, "fixed bug 2")
|
||||
gitTag(t, "v0.0.2")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "first")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
testlib.GitCommit(t, "added feature 1")
|
||||
testlib.GitCommit(t, "fixed bug 2")
|
||||
testlib.GitTag(t, "v0.0.2")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
}
|
||||
@ -219,9 +220,9 @@ func TestChangelog(t *testing.T) {
|
||||
|
||||
func TestChangelogOfFirstRelease(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
testlib.GitInit(t)
|
||||
var msgs = []string{
|
||||
"initial commit",
|
||||
"another one",
|
||||
@ -229,9 +230,9 @@ func TestChangelogOfFirstRelease(t *testing.T) {
|
||||
"and finally this one",
|
||||
}
|
||||
for _, msg := range msgs {
|
||||
gitCommit(t, msg)
|
||||
testlib.GitCommit(t, msg)
|
||||
}
|
||||
gitTag(t, "v0.0.1")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
}
|
||||
@ -245,11 +246,11 @@ func TestChangelogOfFirstRelease(t *testing.T) {
|
||||
|
||||
func TestCustomReleaseNotes(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
_, back := createAndChdir(t)
|
||||
_, back := testlib.Mktmp(t)
|
||||
defer back()
|
||||
gitInit(t)
|
||||
gitCommit(t, "first")
|
||||
gitTag(t, "v0.0.1")
|
||||
testlib.GitInit(t)
|
||||
testlib.GitCommit(t, "first")
|
||||
testlib.GitTag(t, "v0.0.1")
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
ReleaseNotes: "custom",
|
||||
@ -258,60 +259,3 @@ func TestCustomReleaseNotes(t *testing.T) {
|
||||
assert.Equal("v0.0.1", ctx.Git.CurrentTag)
|
||||
assert.Equal(ctx.ReleaseNotes, "custom")
|
||||
}
|
||||
|
||||
//
|
||||
// helper functions
|
||||
//
|
||||
|
||||
func createAndChdir(t *testing.T) (current string, back func()) {
|
||||
var assert = assert.New(t)
|
||||
folder, err := ioutil.TempDir("", "goreleasertest")
|
||||
assert.NoError(err)
|
||||
previous, err := os.Getwd()
|
||||
assert.NoError(err)
|
||||
assert.NoError(os.Chdir(folder))
|
||||
return folder, func() {
|
||||
assert.NoError(os.Chdir(previous))
|
||||
}
|
||||
}
|
||||
|
||||
func gitInit(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
out, err := git("init")
|
||||
assert.NoError(err)
|
||||
assert.Contains(out, "Initialized empty Git repository")
|
||||
_, err = git("config", "commit.gpgSign", "false")
|
||||
assert.NoError(err)
|
||||
}
|
||||
|
||||
func gitCommit(t *testing.T, msg string) {
|
||||
var assert = assert.New(t)
|
||||
out, err := fakeGit("commit", "--allow-empty", "-m", msg)
|
||||
assert.NoError(err)
|
||||
assert.Contains(out, "master", msg)
|
||||
}
|
||||
|
||||
func gitTag(t *testing.T, tag string) {
|
||||
var assert = assert.New(t)
|
||||
out, err := fakeGit("tag", tag)
|
||||
assert.NoError(err)
|
||||
assert.Empty(out)
|
||||
}
|
||||
|
||||
func gitAdd(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
out, err := git("add", "-A")
|
||||
assert.NoError(err)
|
||||
assert.Empty(out)
|
||||
}
|
||||
|
||||
func fakeGit(args ...string) (string, error) {
|
||||
var allArgs = []string{
|
||||
"-c",
|
||||
"user.name='GoReleaser'",
|
||||
"-c",
|
||||
"user.email='test@goreleaser.github.com'",
|
||||
}
|
||||
allArgs = append(allArgs, args...)
|
||||
return git(allArgs...)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user