github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/pkg/build/build_test.go (about)

     1  package build
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/goreleaser/goreleaser/pkg/config"
     7  	"github.com/goreleaser/goreleaser/pkg/context"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  type dummy struct{}
    12  
    13  func (*dummy) WithDefaults(build config.Build) (config.Build, error) {
    14  	return build, nil
    15  }
    16  func (*dummy) Build(ctx *context.Context, build config.Build, options Options) error {
    17  	return nil
    18  }
    19  
    20  func TestRegisterAndGet(t *testing.T) {
    21  	var builder = &dummy{}
    22  	Register("dummy", builder)
    23  	require.Equal(t, builder, For("dummy"))
    24  }