github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/genny/build/build_deps_test.go (about)

     1  package build
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/gobuffalo/envy"
     8  	"github.com/gobuffalo/genny/v2/gentest"
     9  	"github.com/gobuffalo/meta"
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func Test_buildDeps(t *testing.T) {
    14  	r := require.New(t)
    15  
    16  	opts := &Options{
    17  		Tags: meta.BuildTags{"foo"},
    18  	}
    19  
    20  	run := gentest.NewRunner()
    21  	run.WithNew(buildDeps(opts))
    22  
    23  	r.NoError(run.Run())
    24  
    25  	res := run.Results()
    26  
    27  	if envy.Mods() {
    28  		r.Len(res.Commands, 0)
    29  		return
    30  	}
    31  	r.Len(res.Commands, 1)
    32  
    33  	c := res.Commands[0]
    34  	r.Equal("go get -tags development foo ./...", strings.Join(c.Args, " "))
    35  }