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

25 lines
508 B
Go
Raw Normal View History

2017-04-14 12:15:51 -03:00
package context
import (
"testing"
2017-12-29 23:01:17 -02:00
"time"
2017-04-14 12:15:51 -03:00
"github.com/goreleaser/goreleaser/config"
2017-12-18 20:49:13 -02:00
"github.com/stretchr/testify/assert"
2017-04-14 12:15:51 -03:00
)
func TestNew(t *testing.T) {
var ctx = New(config.Project{})
assert.NotEmpty(t, ctx.Env)
assert.Equal(t, 4, ctx.Parallelism)
2017-07-01 21:34:32 -03:00
}
2017-12-29 23:01:17 -02:00
func TestNewWithTimeout(t *testing.T) {
ctx, cancel := NewWithTimeout(config.Project{}, time.Second)
assert.NotEmpty(t, ctx.Env)
assert.Equal(t, 4, ctx.Parallelism)
cancel()
<-ctx.Done()
assert.EqualError(t, ctx.Err(), `context canceled`)
}