Skip to content

Commit

Permalink
Fix typo / inconsistency for (*Msg).SetAttachments
Browse files Browse the repository at this point in the history
  • Loading branch information
alfa-alex committed Aug 14, 2024
1 parent 3e4d8e3 commit 7caf0b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,18 @@ func (m *Msg) GetBoundary() string {
return m.boundary
}

// SetAttachements sets the attachements of the message.
func (m *Msg) SetAttachements(files []*File) {
// SetAttachments sets the attachments of the message.
func (m *Msg) SetAttachments(files []*File) {
m.attachments = files
}

// SetAttachements sets the attachments of the message.
//
// Deprecated: use SetAttachments instead.
func (m *Msg) SetAttachements(files []*File) {
m.SetAttachments(files)

Check warning on line 696 in msg.go

View check run for this annotation

Codecov / codecov/patch

msg.go#L695-L696

Added lines #L695 - L696 were not covered by tests
}

// UnsetAllAttachments unset the attachments of the message.
func (m *Msg) UnsetAllAttachments() {
m.attachments = nil
Expand Down
6 changes: 3 additions & 3 deletions msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ func TestMsg_SetAttachments(t *testing.T) {
for _, f := range tt.files {
files = append(files, &File{Name: f})
}
m.SetAttachements(files)
m.SetAttachments(files)
if len(m.attachments) != len(files) {
t.Errorf("SetAttachements() failed. Number of attachments expected: %d, got: %d", len(files),
len(m.attachments))
Expand Down Expand Up @@ -1448,7 +1448,7 @@ func TestMsg_UnsetAllAttachments(t *testing.T) {
for _, f := range tt.attachments {
files = append(files, &File{Name: f})
}
m.SetAttachements(files)
m.SetAttachments(files)

if len(m.attachments) != len(files) {
t.Errorf("SetAttachements() failed. Number of attachments expected: %d, got: %d", len(files),
Expand Down Expand Up @@ -1610,7 +1610,7 @@ func TestMsg_UnsetAllParts(t *testing.T) {
for _, f := range tt.attachments {
attachments = append(attachments, &File{Name: f})
}
m.SetAttachements(attachments)
m.SetAttachments(attachments)
if len(m.attachments) != len(attachments) {
t.Errorf("SetAttachements() failed. Number of attachments files expected: %d, got: %d",
len(attachments), len(m.attachments))
Expand Down

0 comments on commit 7caf0b8

Please sign in to comment.