1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/context/context_test.go

25 lines
508 B
Go
Raw Normal View History

2017-04-14 17:15:51 +02:00
package context
import (
"testing"
2017-12-30 03:01:17 +02:00
"time"
2017-04-14 17:15:51 +02:00
"github.com/goreleaser/goreleaser/config"
2017-12-19 00:49:13 +02:00
"github.com/stretchr/testify/assert"
2017-04-14 17:15:51 +02:00
)
func TestNew(t *testing.T) {
var ctx = New(config.Project{})
assert.NotEmpty(t, ctx.Env)
assert.Equal(t, 4, ctx.Parallelism)
2017-07-02 02:34:32 +02:00
}
2017-12-30 03: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`)
}