1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00
goreleaser/pipeline/defaults/defaults_test.go

72 lines
1.4 KiB
Go
Raw Normal View History

2017-01-14 14:29:01 -02:00
package defaults
import (
"testing"
"github.com/goreleaser/releaser/config"
"github.com/goreleaser/releaser/context"
"github.com/stretchr/testify/assert"
)
func TestFillBasicData(t *testing.T) {
assert := assert.New(t)
var config = &config.ProjectConfig{}
var ctx = &context.Context{
Config: config,
}
assert.NoError(Pipe{}.Run(ctx))
assert.Equal("goreleaser/releaser", config.Repo)
2017-01-14 19:29:30 +01:00
assert.Equal("releaser", config.BinaryName)
2017-01-14 14:29:01 -02:00
assert.Equal("main.go", config.Build.Main)
assert.Equal("tar.gz", config.Archive.Format)
assert.Contains(config.Build.Oses, "darwin")
assert.Contains(config.Build.Oses, "linux")
assert.Contains(config.Build.Arches, "386")
assert.Contains(config.Build.Arches, "amd64")
2017-01-14 14:38:48 -02:00
assert.NotEmpty(
config.Archive.Replacements,
config.Archive.NameTemplate,
config.Build.Ldflags,
config.Files,
)
}
func TestFilesFilled(t *testing.T) {
assert := assert.New(t)
var config = &config.ProjectConfig{
Files: []string{
"README.md",
},
}
var ctx = &context.Context{
Config: config,
}
assert.NoError(Pipe{}.Run(ctx))
assert.Len(config.Files, 1)
}
func TestAcceptFiles(t *testing.T) {
assert := assert.New(t)
var files = []string{
"LICENSE.md",
2017-01-14 15:17:03 -02:00
"LIceNSE.txt",
2017-01-14 14:38:48 -02:00
"LICENSE",
"LICENCE.txt",
2017-01-14 15:17:03 -02:00
"LICEncE",
2017-01-14 14:38:48 -02:00
"README",
2017-01-14 15:17:03 -02:00
"READme.md",
2017-01-14 14:38:48 -02:00
"CHANGELOG.txt",
2017-01-14 15:17:03 -02:00
"ChanGELOG.md",
2017-01-14 14:38:48 -02:00
}
for _, file := range files {
assert.True(accept(file))
}
2017-01-14 14:29:01 -02:00
}