You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
449 B
Go
28 lines
449 B
Go
4 years ago
|
package errorx
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestChain(t *testing.T) {
|
||
|
var errDummy = errors.New("dummy")
|
||
|
assert.Nil(t, Chain(func() error {
|
||
|
return nil
|
||
|
}, func() error {
|
||
|
return nil
|
||
|
}))
|
||
|
assert.Equal(t, errDummy, Chain(func() error {
|
||
|
return errDummy
|
||
|
}, func() error {
|
||
|
return nil
|
||
|
}))
|
||
|
assert.Equal(t, errDummy, Chain(func() error {
|
||
|
return nil
|
||
|
}, func() error {
|
||
|
return errDummy
|
||
|
}))
|
||
|
}
|