1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-22 04:08:49 +02:00

fix: tests

This commit is contained in:
Carlos Alexandro Becker 2018-12-13 11:26:44 -02:00 committed by Carlos Alexandro Becker
parent 14e93c6390
commit 07d9855890
2 changed files with 1 additions and 32 deletions

View File

@ -62,37 +62,6 @@ func TestNewRepository(t *testing.T) {
assert.Contains(t, Pipe{}.Run(ctx).Error(), `fatal: ambiguous argument 'HEAD'`)
}
func TestNoTagsSnapshot(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()
testlib.GitInit(t)
testlib.GitRemoteAdd(t, "git@github.com:foo/bar.git")
testlib.GitCommit(t, "first")
var ctx = context.New(config.Project{
Snapshot: config.Snapshot{
NameTemplate: "SNAPSHOT-{{.Commit}}",
},
})
ctx.Snapshot = true
testlib.AssertSkipped(t, Pipe{}.Run(ctx))
assert.Contains(t, ctx.Version, "SNAPSHOT-")
}
func TestNoTagsSnapshotInvalidTemplate(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()
testlib.GitInit(t)
testlib.GitRemoteAdd(t, "git@github.com:foo/bar.git")
testlib.GitCommit(t, "first")
var ctx = context.New(config.Project{
Snapshot: config.Snapshot{
NameTemplate: "{{",
},
})
ctx.Snapshot = true
assert.EqualError(t, Pipe{}.Run(ctx), `failed to generate snapshot name: template: tmpl:1: unexpected unclosed action in command`)
}
// TestNoTagsNoSnapshot covers the situation where a repository
// only contains simple commits and no tags. In this case you have
// to set the --snapshot flag otherwise an error is returned.

View File

@ -19,7 +19,7 @@ func TestDefault(t *testing.T) {
},
}
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, "SNAPSHOT-{{ .Commit }}", ctx.Config.Snapshot.NameTemplate)
assert.Equal(t, "SNAPSHOT-{{ .ShortCommit }}", ctx.Config.Snapshot.NameTemplate)
}
func TestDefaultSet(t *testing.T) {