MCPcopy Index your code
hub / github.com/google/go-github / TestErrorResponse_Is

Function TestErrorResponse_Is

github/github_test.go:3491–3646  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3489}
3490
3491func TestErrorResponse_Is(t *testing.T) {
3492 t.Parallel()
3493 err := &ErrorResponse{
3494 Response: &http.Response{},
3495 Message: "m",
3496 Errors: []Error{{Resource: "r", Field: "f", Code: "c"}},
3497 Block: &ErrorBlock{
3498 Reason: "r",
3499 CreatedAt: &Timestamp{time.Date(2016, time.March, 17, 15, 39, 46, 0, time.UTC)},
3500 },
3501 DocumentationURL: "https://github.com",
3502 }
3503 testcases := map[string]struct {
3504 wantSame bool
3505 otherError error
3506 }{
3507 "errors are same": {
3508 wantSame: true,
3509 otherError: &ErrorResponse{
3510 Response: &http.Response{},
3511 Errors: []Error{{Resource: "r", Field: "f", Code: "c"}},
3512 Message: "m",
3513 Block: &ErrorBlock{
3514 Reason: "r",
3515 CreatedAt: &Timestamp{time.Date(2016, time.March, 17, 15, 39, 46, 0, time.UTC)},
3516 },
3517 DocumentationURL: "https://github.com",
3518 },
3519 },
3520 "errors have different values - Message": {
3521 wantSame: false,
3522 otherError: &ErrorResponse{
3523 Response: &http.Response{},
3524 Errors: []Error{{Resource: "r", Field: "f", Code: "c"}},
3525 Message: "m1",
3526 Block: &ErrorBlock{
3527 Reason: "r",
3528 CreatedAt: &Timestamp{time.Date(2016, time.March, 17, 15, 39, 46, 0, time.UTC)},
3529 },
3530 DocumentationURL: "https://github.com",
3531 },
3532 },
3533 "errors have different values - DocumentationURL": {
3534 wantSame: false,
3535 otherError: &ErrorResponse{
3536 Response: &http.Response{},
3537 Errors: []Error{{Resource: "r", Field: "f", Code: "c"}},
3538 Message: "m",
3539 Block: &ErrorBlock{
3540 Reason: "r",
3541 CreatedAt: &Timestamp{time.Date(2016, time.March, 17, 15, 39, 46, 0, time.UTC)},
3542 },
3543 DocumentationURL: "https://google.com",
3544 },
3545 },
3546 "errors have different values - Response is nil": {
3547 wantSame: false,
3548 otherError: &ErrorResponse{

Callers

nothing calls this directly

Calls 2

IsMethod · 0.95
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…