1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00

Improve test coverage for archive skip option.

This commit is contained in:
Jorin Vogel 2017-06-05 18:28:29 +02:00
parent 454abc9a0a
commit de2b5f4385
No known key found for this signature in database
GPG Key ID: 647AFD30D56CE8CC
3 changed files with 55 additions and 0 deletions

View File

@ -186,6 +186,20 @@ func TestRunPipeDraftRelease(t *testing.T) {
assert.False(client.CreatedFile)
}
func TestRunPipeSkipArchive(t *testing.T) {
assert := assert.New(t)
var ctx = &context.Context{
Config: config.Project{
Archive: config.Archive{
Skip: true,
},
},
}
client := &DummyClient{}
assert.NoError(doRun(ctx, client))
assert.False(client.CreatedFile)
}
type DummyClient struct {
CreatedFile bool
}

View File

@ -76,6 +76,35 @@ func TestRunFullPipe(t *testing.T) {
assert.True(exists(post), post)
}
func TestRunPipeSkipArchive(t *testing.T) {
assert := assert.New(t)
folder, err := ioutil.TempDir("", "goreleasertest")
assert.NoError(err)
var binary = filepath.Join(folder, "binary-testing")
var config = config.Project{
Dist: folder,
Build: config.Build{
Binary: "testing",
Goos: []string{
runtime.GOOS,
},
Goarch: []string{
runtime.GOARCH,
},
},
Archive: config.Archive{
Skip: true,
NameTemplate: "binary-{{.Binary}}",
},
}
var ctx = &context.Context{
Config: config,
Archives: map[string]string{},
}
assert.NoError(Pipe{}.Run(ctx))
assert.True(exists(binary))
}
func TestRunPipeArmBuilds(t *testing.T) {
assert := assert.New(t)
folder, err := ioutil.TempDir("", "goreleasertest")

View File

@ -23,6 +23,18 @@ func TestRunPipeNoFormats(t *testing.T) {
assert.NoError(Pipe{}.Run(ctx))
}
func TestRunPipeSkipArchive(t *testing.T) {
var assert = assert.New(t)
var ctx = &context.Context{
Config: config.Project{
Archive: config.Archive{
Skip: true,
},
},
}
assert.NoError(Pipe{}.Run(ctx))
}
func TestRunPipe(t *testing.T) {
var assert = assert.New(t)
folder, err := ioutil.TempDir("", "archivetest")