(t *testing.T)
| 33 | } |
| 34 | |
| 35 | func TestDecodeWithError(t *testing.T) { |
| 36 | type DE struct { |
| 37 | CommonError |
| 38 | } |
| 39 | var obj DE |
| 40 | err := DecodeWithError([]byte(errData), &obj, "Send") |
| 41 | if err == nil { |
| 42 | t.Error("DecodeWithError should return error") |
| 43 | return |
| 44 | } |
| 45 | |
| 46 | cErr, ok := err.(*CommonError) |
| 47 | if !ok { |
| 48 | t.Errorf("DecodeWithError should return *CommonError but %T", err) |
| 49 | return |
| 50 | } |
| 51 | if !(cErr.ErrCode == 43101 && cErr.ErrMsg == "user refuse to accept the msg" && cErr.Error() == expectError) { |
| 52 | t.Error("DecodeWithError return bad *CommonError") |
| 53 | return |
| 54 | } |
| 55 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…