mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-22 04:08:49 +02:00
fix: tests
This commit is contained in:
parent
14e93c6390
commit
07d9855890
@ -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.
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user