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

Merge pull request #151 from goreleaser/tests

adding more tests
This commit is contained in:
Carlos Alexandro Becker 2017-03-25 20:48:44 -03:00 committed by GitHub
commit 75aef323fb
6 changed files with 73 additions and 0 deletions

View File

@ -7,6 +7,10 @@ import (
"github.com/stretchr/testify/assert"
)
func TestDescription(t *testing.T) {
assert.NotEmpty(t, Pipe{}.Description())
}
func TestNameWithDash(t *testing.T) {
assert.Equal(t, formulaNameFor("some-binary"), "SomeBinary")
}

View File

@ -6,6 +6,10 @@ import (
"github.com/stretchr/testify/assert"
)
func TestDescription(t *testing.T) {
assert.NotEmpty(t, Pipe{}.Description())
}
func TestValid(t *testing.T) {
assert.True(t, valid("windows", "386"))
assert.True(t, valid("linux", "386"))

View File

@ -8,6 +8,10 @@ import (
"github.com/stretchr/testify/assert"
)
func TestDescription(t *testing.T) {
assert.NotEmpty(t, Pipe{}.Description())
}
func TestFillBasicData(t *testing.T) {
assert := assert.New(t)

32
pipeline/env/env_test.go vendored Normal file
View File

@ -0,0 +1,32 @@
package env
import (
"os"
"testing"
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/context"
"github.com/stretchr/testify/assert"
)
func TestDescription(t *testing.T) {
assert.NotEmpty(t, Pipe{}.Description())
}
func TestValidEnv(t *testing.T) {
assert := assert.New(t)
var ctx = &context.Context{
Config: config.Project{},
}
assert.NoError(Pipe{}.Run(ctx))
}
func TestInvalidEnv(t *testing.T) {
assert := assert.New(t)
os.Unsetenv("GITHUB_TOKEN")
var ctx = &context.Context{
Config: config.Project{},
}
assert.Error(Pipe{}.Run(ctx))
}

25
pipeline/git/git_test.go Normal file
View File

@ -0,0 +1,25 @@
package git
import (
"testing"
"github.com/goreleaser/goreleaser/config"
"github.com/goreleaser/goreleaser/context"
"github.com/stretchr/testify/assert"
)
func TestDescription(t *testing.T) {
assert.NotEmpty(t, Pipe{}.Description())
}
func TestValidVersion(t *testing.T) {
assert := assert.New(t)
var ctx = &context.Context{
Config: config.Project{},
}
assert.NoError(Pipe{}.Run(ctx))
assert.NotEmpty(ctx.Git.CurrentTag)
assert.NotEmpty(ctx.Git.PreviousTag)
assert.NotEmpty(ctx.Git.Diff)
}

View File

@ -7,6 +7,10 @@ import (
"github.com/stretchr/testify/assert"
)
func TestPipeDescription(t *testing.T) {
assert.NotEmpty(t, Pipe{}.Description())
}
func TestDescription(t *testing.T) {
assert := assert.New(t)
desc := description("0abf342 some message")