1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00
goreleaser/pipeline/build/name_test.go

45 lines
866 B
Go
Raw Normal View History

2017-01-14 15:08:10 -02:00
package build
import (
"testing"
2017-01-14 20:01:32 -02:00
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/context"
2017-01-14 15:08:10 -02:00
"github.com/stretchr/testify/assert"
)
func TestExtWindows(t *testing.T) {
assert.Equal(t, extFor("windows"), ".exe")
}
func TestExtOthers(t *testing.T) {
assert.Empty(t, extFor("linux"))
}
func TestNameFor(t *testing.T) {
assert := assert.New(t)
2017-01-18 15:08:48 -02:00
var config = config.Project{
2017-01-15 14:53:24 -02:00
Archive: config.Archive{
2017-03-22 21:06:37 -03:00
NameTemplate: "{{.Binary}}_{{.Os}}_{{.Arch}}_{{.Version}}",
2017-01-14 15:08:10 -02:00
Replacements: map[string]string{
"darwin": "Darwin",
"amd64": "x86_64",
},
},
2017-01-15 14:53:24 -02:00
Build: config.Build{
2017-03-22 21:06:37 -03:00
Binary: "test",
2017-01-14 19:52:39 -02:00
},
2017-01-14 15:08:10 -02:00
}
var ctx = &context.Context{
Config: config,
2017-01-18 15:08:48 -02:00
Git: context.GitInfo{
2017-01-14 15:08:10 -02:00
CurrentTag: "v1.2.3",
},
}
name, err := nameFor(ctx, "darwin", "amd64")
assert.NoError(err)
assert.Equal("test_Darwin_x86_64_v1.2.3", name)
}