MCPcopy
hub / github.com/silenceper/wechat / TestDecodeWithCommonError

Function TestDecodeWithCommonError

util/error_test.go:17–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15}
16
17func TestDecodeWithCommonError(t *testing.T) {
18 err := DecodeWithCommonError([]byte(errData), "Send")
19 if err == nil {
20 t.Error("DecodeWithCommonError should return error")
21 return
22 }
23
24 cErr, ok := err.(*CommonError)
25 if !ok {
26 t.Errorf("DecodeWithCommonError should return *CommonError but %T", err)
27 return
28 }
29 if !(cErr.ErrCode == 43101 && cErr.ErrMsg == "user refuse to accept the msg" && cErr.Error() == expectError) {
30 t.Error("DecodeWithCommonError return bad *CommonError")
31 return
32 }
33}
34
35func TestDecodeWithError(t *testing.T) {
36 type DE struct {

Callers

nothing calls this directly

Calls 2

DecodeWithCommonErrorFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…