mirror of
https://github.com/wneessen/go-mail.git
synced 2024-12-23 02:50:39 +01:00
Test for message part deletion
Added a test for the `Part.Delete` method
This commit is contained in:
parent
9724a2b523
commit
c602ba103f
1 changed files with 16 additions and 0 deletions
16
part_test.go
16
part_test.go
|
@ -241,6 +241,22 @@ func TestPart_SetContent(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestPart_Delete tests Part.Delete
|
||||
func TestPart_Delete(t *testing.T) {
|
||||
c := "This is a test with ümläutß"
|
||||
m := NewMsg()
|
||||
m.SetBodyString(TypeTextPlain, c)
|
||||
pl, err := getPartList(m)
|
||||
if err != nil {
|
||||
t.Errorf("failed: %s", err)
|
||||
return
|
||||
}
|
||||
pl[0].Delete()
|
||||
if !pl[0].del {
|
||||
t.Errorf("Delete failed. Expected: %t, got: %t", true, pl[0].del)
|
||||
}
|
||||
}
|
||||
|
||||
// getPartList is a helper function
|
||||
func getPartList(m *Msg) ([]*Part, error) {
|
||||
pl := m.GetParts()
|
||||
|
|
Loading…
Reference in a new issue