mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-21 21:07:19 +02:00
This starts laying the foundation for supporting more languages, the first of which will probably be Zig, and then Rust. I already have a zig prototype working in another branch, just raw dogged it to see if it would work, and since it does, now I'll do it piece by piece but with hopefully slightly better code.
31 lines
664 B
Go
31 lines
664 B
Go
package testlib
|
|
|
|
import (
|
|
"slices"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/goreleaser/goreleaser/v2/internal/artifact"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func RequireEqualArtifacts(tb testing.TB, expected, got []*artifact.Artifact) {
|
|
tb.Helper()
|
|
slices.SortFunc(expected, artifactSort)
|
|
slices.SortFunc(got, artifactSort)
|
|
require.Equal(tb, filenames(expected), filenames(got))
|
|
require.Equal(tb, expected, got)
|
|
}
|
|
|
|
func artifactSort(a, b *artifact.Artifact) int {
|
|
return strings.Compare(a.Path, b.Path)
|
|
}
|
|
|
|
func filenames(ts []*artifact.Artifact) []string {
|
|
result := make([]string, len(ts))
|
|
for i, t := range ts {
|
|
result[i] = t.Path
|
|
}
|
|
return result
|
|
}
|