a56b284b0e
No real functional change. A few are needed and they will come next. With this diff I just wanted to do cosmetic changes and documentation changes, to ensure this package is okay. See https://github.com/ooni/probe/issues/1591
27 lines
468 B
Go
27 lines
468 B
Go
package errorsx
|
|
|
|
import (
|
|
"errors"
|
|
"io"
|
|
"testing"
|
|
)
|
|
|
|
func TestErrWrapper(t *testing.T) {
|
|
t.Run("Error", func(t *testing.T) {
|
|
err := &ErrWrapper{Failure: FailureDNSNXDOMAINError}
|
|
if err.Error() != FailureDNSNXDOMAINError {
|
|
t.Fatal("invalid return value")
|
|
}
|
|
})
|
|
|
|
t.Run("Unwrap", func(t *testing.T) {
|
|
err := &ErrWrapper{
|
|
Failure: FailureEOFError,
|
|
WrappedErr: io.EOF,
|
|
}
|
|
if !errors.Is(err, io.EOF) {
|
|
t.Fatal("cannot unwrap error")
|
|
}
|
|
})
|
|
}
|