github.com/sergiusens/goreleaser@v0.34.3-0.20171009111917-ae6f7c157c5c/internal/archiveformat/format_test.go (about)

     1  package archiveformat
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/goreleaser/goreleaser/config"
     7  	"github.com/goreleaser/goreleaser/context"
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestFormatFor(t *testing.T) {
    12  	var ctx = &context.Context{
    13  		Config: config.Project{
    14  			Archive: config.Archive{
    15  				Format: "tar.gz",
    16  				FormatOverrides: []config.FormatOverride{
    17  					{
    18  						Goos:   "windows",
    19  						Format: "zip",
    20  					},
    21  				},
    22  			},
    23  		},
    24  	}
    25  	assert.Equal(t, "zip", For(ctx, "windowsamd64"))
    26  	assert.Equal(t, "tar.gz", For(ctx, "linux386"))
    27  }