From a432839ad44a28531f4ffe2b1cb41e36a95b5126 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Sun, 3 Dec 2017 12:05:58 -0200 Subject: [PATCH] test: brew tests Added more tests to cover defaulter. --- pipeline/brew/brew_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/pipeline/brew/brew_test.go b/pipeline/brew/brew_test.go index 111357f1b..7e513bf71 100644 --- a/pipeline/brew/brew_test.go +++ b/pipeline/brew/brew_test.go @@ -268,6 +268,40 @@ func TestRunPipeFormatBinary(t *testing.T) { assert.False(t, client.CreatedFile) } +func TestDefault(t *testing.T) { + _, back := testlib.Mktmp(t) + defer back() + + var ctx = &context.Context{ + Config: config.Project{ + Builds: []config.Build{ + { + Binary: "foo", + Goos: []string{"linux", "darwin"}, + Goarch: []string{"386", "amd64"}, + }, + { + Binary: "bar", + Goos: []string{"linux", "darwin"}, + Goarch: []string{"386", "amd64"}, + Ignore: []config.IgnoredBuild{ + {Goos: "darwin", Goarch: "amd64"}, + }, + }, + { + Binary: "foobar", + Goos: []string{"linux"}, + Goarch: []string{"amd64"}, + }, + }, + }, + } + assert.NoError(t, Pipe{}.Default(ctx)) + assert.NotEmpty(t, ctx.Config.Brew.CommitAuthor.Name) + assert.NotEmpty(t, ctx.Config.Brew.CommitAuthor.Email) + assert.Equal(t, `bin.install "foo"`, ctx.Config.Brew.Install) +} + type DummyClient struct { CreatedFile bool Content string