mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-02 22:05:46 +02:00
28 lines
553 B
Go
28 lines
553 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNameTemplate(t *testing.T) {
|
|
assert := assert.New(t)
|
|
var config = ProjectConfig{
|
|
BinaryName: "test",
|
|
Git: GitInfo{
|
|
CurrentTag: "v1.2.3",
|
|
},
|
|
Archive: ArchiveConfig{
|
|
NameTemplate: "{{.BinaryName}}_{{.Os}}_{{.Arch}}_{{.Version}}",
|
|
Replacements: map[string]string{
|
|
"darwin": "Darwin",
|
|
"amd64": "x86_64",
|
|
},
|
|
},
|
|
}
|
|
name, err := config.ArchiveName("darwin", "amd64")
|
|
assert.NoError(err)
|
|
assert.Equal("test_Darwin_x86_64_v1.2.3", name)
|
|
}
|