You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
kratos/errors/wrap_test.go

23 lines
381 B

package errors
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
type mockErr struct{}
func (*mockErr) Error() string {
return "mock error"
}
func TestWarp(t *testing.T) {
var err error = &mockErr{}
err2 := fmt.Errorf("wrap %w", err)
assert.Equal(t, err, Unwrap(err2))
assert.True(t, Is(err2, err))
err3 := &mockErr{}
assert.True(t, As(err2, &err3))
}