1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/pkg/promise/promise_test.go
Naveed Jamil cffa6d52a2 Added Test Case Coverage for PKG/PROMISE
Signed-off-by: Naveed Jamil <naveed.jamil@tenpearls.com>
2017-06-13 15:17:40 +05:00

25 lines
428 B
Go

package promise
import (
"errors"
"testing"
"github.com/stretchr/testify/require"
)
func TestGo(t *testing.T) {
errCh := Go(functionWithError)
er := <-errCh
require.EqualValues(t, "Error Occurred", er.Error())
noErrCh := Go(functionWithNoError)
er = <-noErrCh
require.Nil(t, er)
}
func functionWithError() (err error) {
return errors.New("Error Occurred")
}
func functionWithNoError() (err error) {
return nil
}