19 lines
567 B
Go
19 lines
567 B
Go
package errs_test
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"git.maronato.dev/maronato/goshort/internal/errs"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestErrorf(t *testing.T) {
|
|
ErrMyError := errors.New("my error") //nolint:goerr113 // This is a test error
|
|
|
|
err := errs.Errorf("my message", ErrMyError)
|
|
|
|
assert.ErrorIs(t, err, ErrMyError, "Errorf should return an error with the same error type as the one passed as argument")
|
|
assert.Equal(t, "my message: my error", err.Error(), "Errorf should return an error with the same message as the one passed as argument")
|
|
}
|