1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

added more archive pipe test

This commit is contained in:
Carlos Alexandro Becker 2017-04-22 10:29:53 -03:00
parent 2919edc13f
commit 26727a6f7f
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 18 additions and 2 deletions

View File

@ -47,10 +47,10 @@ func create(ctx *context.Context, platform, name string) error {
var folder = filepath.Join(ctx.Config.Dist, name)
var format = formatFor(ctx, platform)
file, err := os.Create(folder + "." + format)
log.Println("Creating", file.Name())
if err != nil {
return err
}
log.Println("Creating", file.Name())
defer func() { _ = file.Close() }()
var archive = archiveFor(file, format)
defer func() { _ = archive.Close() }()

View File

@ -64,6 +64,23 @@ func TestRunPipe(t *testing.T) {
})
}
func TestRunPipeDistRemoved(t *testing.T) {
var assert = assert.New(t)
var ctx = &context.Context{
Archives: map[string]string{
"darwinamd64": "mybin",
"windowsamd64": "mybin",
},
Config: config.Project{
Dist: "/path/nope",
Archive: config.Archive{
Format: "zip",
},
},
}
assert.Error(Pipe{}.Run(ctx))
}
func TestFormatFor(t *testing.T) {
var assert = assert.New(t)
var ctx = &context.Context{

View File

@ -12,7 +12,6 @@ import (
func remoteRepo() (result config.Repo, err error) {
cmd := exec.Command("git", "config", "--get", "remote.origin.url")
bts, err := cmd.CombinedOutput()
// TODO: cover this with tests
if err != nil {
return result, errors.New(err.Error() + ": " + string(bts))
}