#42: Add test for Msg.EnvelopeFromFormat

This commit is contained in:
Winni Neessen 2022-09-08 15:08:03 +02:00
parent fa4eca20f1
commit 333c3970e7
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -617,7 +617,7 @@ func TestMsg_SetMessageIDWithValue(t *testing.T) {
} }
} }
// TestMsg_FromFormat tests the FromFormat() method for the Msg object // TestMsg_FromFormat tests the FromFormat and EnvelopeFrom methods for the Msg object
func TestMsg_FromFormat(t *testing.T) { func TestMsg_FromFormat(t *testing.T) {
tests := []struct { tests := []struct {
tname string tname string
@ -641,6 +641,10 @@ func TestMsg_FromFormat(t *testing.T) {
t.Errorf("failed to FromFormat(): %s", err) t.Errorf("failed to FromFormat(): %s", err)
return return
} }
if err := m.EnvelopeFromFormat(tt.name, tt.addr); err != nil && !tt.fail {
t.Errorf("failed to EnvelopeFromFormat(): %s", err)
return
}
var fa *mail.Address var fa *mail.Address
f, ok := m.addrHeader[HeaderFrom] f, ok := m.addrHeader[HeaderFrom]