MCPcopy Create free account
hub / github.com/pion/dtls / TestErrorUnwrap

Function TestErrorUnwrap

errors_test.go:17–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15var errExample = errors.New("an example error")
16
17func TestErrorUnwrap(t *testing.T) {
18 cases := []struct {
19 err error
20 errUnwrapped []error
21 }{
22 {
23 &FatalError{Err: errExample},
24 []error{errExample},
25 },
26 {
27 &TemporaryError{Err: errExample},
28 []error{errExample},
29 },
30 {
31 &InternalError{Err: errExample},
32 []error{errExample},
33 },
34 {
35 &TimeoutError{Err: errExample},
36 []error{errExample},
37 },
38 {
39 &HandshakeError{Err: errExample},
40 []error{errExample},
41 },
42 }
43 for _, c := range cases {
44 t.Run(fmt.Sprintf("%T", c.err), func(t *testing.T) {
45 err := c.err
46 for _, unwrapped := range c.errUnwrapped {
47 assert.ErrorIs(t, errors.Unwrap(err), unwrapped)
48 }
49 })
50 }
51}
52
53func TestErrorNetError(t *testing.T) {
54 cases := []struct {

Callers

nothing calls this directly

Calls 2

RunMethod · 0.80
UnwrapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…