1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/pipeline/build/name_test.go
2017-01-18 15:08:48 -02:00

45 lines
874 B
Go

package build
import (
"testing"
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/context"
"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)
var config = config.Project{
Archive: config.Archive{
NameTemplate: "{{.BinaryName}}_{{.Os}}_{{.Arch}}_{{.Version}}",
Replacements: map[string]string{
"darwin": "Darwin",
"amd64": "x86_64",
},
},
Build: config.Build{
BinaryName: "test",
},
}
var ctx = &context.Context{
Config: config,
Git: context.GitInfo{
CurrentTag: "v1.2.3",
},
}
name, err := nameFor(ctx, "darwin", "amd64")
assert.NoError(err)
assert.Equal("test_Darwin_x86_64_v1.2.3", name)
}