1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

test: added a test case for an invalid main.go

The user could set the main to anything, so, added a test
for an invalid file as main.
This commit is contained in:
Carlos Alexandro Becker 2017-11-19 16:06:26 -02:00 committed by Carlos Alexandro Becker
parent 5a2f6d0318
commit a9f33bd659

View File

@ -275,6 +275,10 @@ func TestRunPipeWithouMainFunc(t *testing.T) {
ctx.Config.Builds[0].Main = ""
assert.EqualError(t, Pipe{}.Run(ctx), `build for no-main does not contain a main function`)
})
t.Run("not main.go", func(t *testing.T) {
ctx.Config.Builds[0].Main = "foo.go"
assert.EqualError(t, Pipe{}.Run(ctx), `failed dir: foo.go: open foo.go: no such file or directory`)
})
t.Run("glob", func(t *testing.T) {
ctx.Config.Builds[0].Main = "."
assert.EqualError(t, Pipe{}.Run(ctx), `build for no-main does not contain a main function`)