github.phpd.cn/goreleaser/goreleaser@v0.92.0/internal/pipe/effectiveconfig/config_test.go (about)

     1  package effectiveconfig
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  	"path/filepath"
     7  	"testing"
     8  
     9  	"github.com/goreleaser/goreleaser/internal/testlib"
    10  	"github.com/goreleaser/goreleaser/pkg/config"
    11  	"github.com/goreleaser/goreleaser/pkg/context"
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  func TestPipeDescription(t *testing.T) {
    16  	assert.NotEmpty(t, Pipe{}.String())
    17  }
    18  
    19  func Test(t *testing.T) {
    20  	folder, back := testlib.Mktmp(t)
    21  	defer back()
    22  	dist := filepath.Join(folder, "dist")
    23  	assert.NoError(t, os.Mkdir(dist, 0755))
    24  	var ctx = context.New(
    25  		config.Project{
    26  			Dist: dist,
    27  		},
    28  	)
    29  	assert.NoError(t, Pipe{}.Run(ctx))
    30  	bts, err := ioutil.ReadFile(filepath.Join(dist, "config.yaml"))
    31  	assert.NoError(t, err)
    32  	assert.NotEmpty(t, string(bts))
    33  }