diff --git a/senderror_test.go b/senderror_test.go index bf823e9..9a9b1ec 100644 --- a/senderror_test.go +++ b/senderror_test.go @@ -145,6 +145,24 @@ func TestSendError_MsgNil(t *testing.T) { } } +func TestSendError_IsFail(t *testing.T) { + err1 := returnSendError(ErrAmbiguous, false) + err2 := returnSendError(ErrSMTPMailFrom, false) + if errors.Is(err1, err2) { + t.Errorf("error mismatch, ErrAmbiguous should not be equal to ErrSMTPMailFrom") + } +} + +func TestSendError_ErrorMulti(t *testing.T) { + expected := `ambiguous reason, check Msg.SendError for message specific reasons, ` + + `affected recipient(s): , ` + err := &SendError{Reason: ErrAmbiguous, isTemp: false, affectedMsg: nil, + rcpt: []string{"", ""}} + if err.Error() != expected { + t.Errorf("error mismatch, expected: %s, got: %s", expected, err.Error()) + } +} + // returnSendError is a helper method to retunr a SendError with a specific reason func returnSendError(r SendErrReason, t bool) error { message := NewMsg()