2021-03-03 11:28:39 +01:00
|
|
|
package sessionresolver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"io"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/google/go-cmp/cmp"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestErrWrapper(t *testing.T) {
|
2022-06-08 22:01:51 +02:00
|
|
|
ew := newErrWrapper(io.EOF, "https://dns.quad9.net/dns-query")
|
2021-03-03 11:28:39 +01:00
|
|
|
o := ew.Error()
|
|
|
|
expect := "<https://dns.quad9.net/dns-query> EOF"
|
|
|
|
if diff := cmp.Diff(expect, o); diff != "" {
|
|
|
|
t.Fatal(diff)
|
|
|
|
}
|
|
|
|
if !errors.Is(ew, io.EOF) {
|
|
|
|
t.Fatal("not the sub-error we expected")
|
|
|
|
}
|
2022-06-08 22:01:51 +02:00
|
|
|
if errors.Unwrap(ew) != io.EOF {
|
|
|
|
t.Fatal("unwrap failed")
|
|
|
|
}
|
2021-03-03 11:28:39 +01:00
|
|
|
}
|