1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00
goreleaser/pipeline/defaults/defaults_test.go
Carlos Alexandro Becker 644978173f
renaming fixes
2017-01-15 14:53:24 -02:00

74 lines
1.4 KiB
Go

package defaults
import (
"testing"
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/context"
"github.com/stretchr/testify/assert"
)
func TestFillBasicData(t *testing.T) {
assert := assert.New(t)
var config = &config.Project{}
var ctx = &context.Context{
Config: config,
}
assert.NoError(Pipe{}.Run(ctx))
assert.Equal("goreleaser/goreleaser", config.Release.Repo)
assert.Equal("goreleaser", config.Build.BinaryName)
assert.Equal("main.go", config.Build.Main)
assert.Equal("tar.gz", config.Archive.Format)
assert.Contains(config.Build.Goos, "darwin")
assert.Contains(config.Build.Goos, "linux")
assert.Contains(config.Build.Goarch, "386")
assert.Contains(config.Build.Goarch, "amd64")
assert.NotEmpty(
config.Archive.Replacements,
config.Archive.NameTemplate,
config.Build.Ldflags,
config.Archive.Files,
)
}
func TestFilesFilled(t *testing.T) {
assert := assert.New(t)
var config = &config.Project{
Archive: config.Archive{
Files: []string{
"README.md",
},
},
}
var ctx = &context.Context{
Config: config,
}
assert.NoError(Pipe{}.Run(ctx))
assert.Len(config.Archive.Files, 1)
}
func TestAcceptFiles(t *testing.T) {
assert := assert.New(t)
var files = []string{
"LICENSE.md",
"LIceNSE.txt",
"LICENSE",
"LICENCE.txt",
"LICEncE",
"README",
"READme.md",
"CHANGELOG.txt",
"ChanGELOG.md",
}
for _, file := range files {
assert.True(accept(file))
}
}