mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-08 03:31:59 +02:00
35 lines
592 B
Go
35 lines
592 B
Go
|
package context
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"golang.org/x/sync/errgroup"
|
||
|
|
||
|
"github.com/goreleaser/goreleaser/config"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
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")
|
||
|
}
|