(t *testing.T, expectedRes, res bool, expectedErrMsg string)
| 3663 | } |
| 3664 | |
| 3665 | func (ctt *captureTestingT) checkResultAndErrMsg(t *testing.T, expectedRes, res bool, expectedErrMsg string) { |
| 3666 | t.Helper() |
| 3667 | if res != expectedRes { |
| 3668 | t.Errorf("Should return %t", expectedRes) |
| 3669 | return |
| 3670 | } |
| 3671 | if res == ctt.failed { |
| 3672 | t.Errorf("The test result (%t) should be reflected in the testing.T type (%t)", res, !ctt.failed) |
| 3673 | return |
| 3674 | } |
| 3675 | contents := parseLabeledOutput(ctt.msg) |
| 3676 | if res == true { |
| 3677 | if contents != nil { |
| 3678 | t.Errorf("Should not log an error. Log output: %q", ctt.msg) |
| 3679 | } |
| 3680 | return |
| 3681 | } |
| 3682 | if contents == nil { |
| 3683 | t.Errorf("Should log an error. Log output: %q", ctt.msg) |
| 3684 | return |
| 3685 | } |
| 3686 | for _, content := range contents { |
| 3687 | if content.label == "Error" { |
| 3688 | if expectedErrMsg == content.content { |
| 3689 | return |
| 3690 | } |
| 3691 | t.Errorf("Recorded Error: %q", content.content) |
| 3692 | } |
| 3693 | } |
| 3694 | t.Errorf("Expected Error: %q", expectedErrMsg) |
| 3695 | } |
| 3696 | |
| 3697 | func TestErrorIs(t *testing.T) { |
| 3698 | t.Parallel() |
no test coverage detected