1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00
goreleaser/context/context_test.go

59 lines
1.1 KiB
Go
Raw Normal View History

2017-04-14 17:15:51 +02:00
package context
import (
"testing"
"github.com/goreleaser/goreleaser/config"
"github.com/stretchr/testify/assert"
2017-06-22 05:09:14 +02:00
"golang.org/x/sync/errgroup"
2017-04-14 17:15:51 +02:00
)
func TestMultipleArtifactAdds(t *testing.T) {
var assert = assert.New(t)
var list = []string{
"dist/a",
"dist/b",
"dist/c",
"dist/d",
}
var ctx = New(config.Project{
Dist: "dist",
})
var g errgroup.Group
for _, f := range list {
f := f
g.Go(func() error {
ctx.AddArtifact(f)
return nil
})
}
assert.NoError(g.Wait())
assert.Len(ctx.Artifacts, len(list))
assert.Contains(ctx.Artifacts, "a", "b", "c", "d")
}
2017-07-02 02:34:32 +02:00
func TestMultipleBinaryAdds(t *testing.T) {
2017-07-02 02:34:32 +02:00
var assert = assert.New(t)
var list = map[string]string{
"a": "folder/a",
"b": "folder/b",
"c": "folder/c",
"d": "folder/d",
2017-07-02 02:34:32 +02:00
}
var ctx = New(config.Project{
Dist: "dist",
})
var g errgroup.Group
for k, f := range list {
f := f
k := k
g.Go(func() error {
2017-07-14 01:43:12 +02:00
ctx.AddBinary("linuxamd64", k, k, f)
2017-07-02 02:34:32 +02:00
return nil
})
}
assert.NoError(g.Wait())
assert.Len(ctx.Binaries["linuxamd64"], len(list))
assert.Len(ctx.Binaries, 1)
2017-07-02 02:34:32 +02:00
}