1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00

test: add test for name_template with env var

Add a test for name_template with an env var.
This commit is contained in:
Frank Schroeder 2017-12-07 22:59:30 +01:00 committed by Carlos Alexandro Becker
parent ca3eedfea8
commit 904d4455f4

View File

@ -84,7 +84,7 @@ func TestRunPipeFormatBinary(t *testing.T) {
folder, back := testlib.Mktmp(t)
defer back()
writeGoodMain(t, folder)
var binary = filepath.Join(folder, "binary-testing")
var binary = filepath.Join(folder, "binary-testing-bar")
var config = config.Project{
ProjectName: "testing",
Dist: folder,
@ -101,10 +101,12 @@ func TestRunPipeFormatBinary(t *testing.T) {
},
Archive: config.Archive{
Format: "binary",
NameTemplate: "binary-{{.Binary}}",
NameTemplate: "binary-{{.Binary}}-{{.Env.Foo}}",
},
}
assert.NoError(t, Pipe{}.Run(context.New(config)))
ctx := context.New(config)
ctx.Env = map[string]string{"Foo": "bar"}
assert.NoError(t, Pipe{}.Run(ctx))
assert.True(t, exists(binary))
}