Add a new test for no default user agent in msg_test.go

A new test function named "TestNewMsgWithNoDefaultUserAgent" has been added in `msg_test.go` file. This function is meant to test 'NewMsg' function with 'WithNoDefaultUserAgent' parameter. The addition is devised to enhance the test coverage and ensure the noDefaultUserAgent field is functioning correctly.
This commit is contained in:
Winni Neessen 2024-02-26 21:03:20 +01:00
parent c0cf31b6c4
commit 180f6f3a63
Signed by: wneessen
GPG key ID: 5F3AF39B820C119D

View file

@ -3211,3 +3211,11 @@ func TestMsg_checkUserAgent(t *testing.T) {
})
}
}
// TestNewMsgWithMIMEVersion tests WithMIMEVersion and Msg.SetMIMEVersion
func TestNewMsgWithNoDefaultUserAgent(t *testing.T) {
m := NewMsg(WithNoDefaultUserAgent())
if m.noDefaultUserAgent != true {
t.Errorf("WithNoDefaultUserAgent() failed. Expected: %t, got: %t", true, false)
}
}