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
446 B
Go
28 lines
446 B
Go
package errorx
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestChain(t *testing.T) {
|
|
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
|
|
}))
|
|
}
|