context_test.go 385 B

12345678910111213141516171819202122
  1. package ctx
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestBackground(t *testing.T) {
  7. workDir := "."
  8. ctx, err := Prepare(workDir)
  9. assert.Nil(t, err)
  10. assert.True(t, true, func() bool {
  11. return len(ctx.Dir) != 0 && len(ctx.Path) != 0
  12. }())
  13. }
  14. func TestBackgroundNilWorkDir(t *testing.T) {
  15. workDir := ""
  16. _, err := Prepare(workDir)
  17. assert.NotNil(t, err)
  18. }