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

Function TestErrorNetError

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

Source from the content-addressed store, hash-verified

51}
52
53func TestErrorNetError(t *testing.T) {
54 cases := []struct {
55 err error
56 str string
57 timeout, temporary bool
58 }{
59 {&FatalError{Err: errExample}, "dtls fatal: an example error", false, false},
60 {&TemporaryError{Err: errExample}, "dtls temporary: an example error", false, true},
61 {&InternalError{Err: errExample}, "dtls internal: an example error", false, false},
62 {&TimeoutError{Err: errExample}, "dtls timeout: an example error", true, true},
63 {&HandshakeError{Err: errExample}, "handshake error: an example error", false, false},
64 {&HandshakeError{Err: &TimeoutError{Err: errExample}}, "handshake error: dtls timeout: an example error", true, true},
65 }
66 for _, testCase := range cases {
67 t.Run(fmt.Sprintf("%T", testCase.err), func(t *testing.T) {
68 var ne net.Error
69 assert.ErrorAs(t, testCase.err, &ne)
70 assert.Equal(t, testCase.timeout, ne.Timeout())
71 assert.Equal(t, testCase.temporary, ne.Temporary()) //nolint:staticcheck
72 assert.Equal(t, testCase.str, ne.Error())
73 })
74 }
75}

Callers

nothing calls this directly

Calls 5

RunMethod · 0.80
EqualMethod · 0.80
TimeoutMethod · 0.45
TemporaryMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…