mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
c805451de0
* Reordered indexes in docs * Fix customization order * Implemented extra files * Added tests for extra files * Added docs * Fix test with defaults * Removed path and folder from extra_files * Fix scope lint * Removed dead code * Removed dead code * Added test for common package * Fix linting * Removed false positive from golangci * Requested changes
69 lines
1.4 KiB
Go
69 lines
1.4 KiB
Go
package extrafiles
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/goreleaser/goreleaser/pkg/config"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestShouldGetAllFiles(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
globs := []config.ExtraFile{
|
|
{Glob: "./testdata/file1.golden"},
|
|
}
|
|
|
|
files, err := Find(globs)
|
|
assert.NoError(err)
|
|
assert.Equal(1, len(files))
|
|
|
|
path, ok := files["file1.golden"]
|
|
assert.True(ok)
|
|
assert.Equal(path, "./testdata/file1.golden")
|
|
}
|
|
|
|
func TestShouldGetAllFilesWithGoldenExtension(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
globs := []config.ExtraFile{
|
|
{Glob: "./testdata/*.golden"},
|
|
}
|
|
|
|
files, err := Find(globs)
|
|
assert.NoError(err)
|
|
assert.Equal(2, len(files))
|
|
|
|
path, ok := files["file1.golden"]
|
|
assert.True(ok)
|
|
assert.Equal(path, "testdata/file1.golden")
|
|
|
|
path, ok = files["file2.golden"]
|
|
assert.True(ok)
|
|
assert.Equal(path, "testdata/file2.golden")
|
|
}
|
|
|
|
func TestShouldGetAllFilesInsideTestdata(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
globs := []config.ExtraFile{
|
|
{Glob: "./testdata/*"},
|
|
}
|
|
|
|
files, err := Find(globs)
|
|
assert.NoError(err)
|
|
assert.Equal(3, len(files))
|
|
|
|
path, ok := files["file1.golden"]
|
|
assert.True(ok)
|
|
assert.Equal(path, "testdata/file1.golden")
|
|
|
|
path, ok = files["file2.golden"]
|
|
assert.True(ok)
|
|
assert.Equal(path, "testdata/file2.golden")
|
|
|
|
path, ok = files["file3.gold"]
|
|
assert.True(ok)
|
|
assert.Equal(path, "testdata/file3.gold")
|
|
}
|