Skip to content

Commit

Permalink
Merge pull request #354 from wneessen/test_close_on_nil
Browse files Browse the repository at this point in the history
Add test for closing a nil smtpclient
  • Loading branch information
wneessen authored Nov 6, 2024
2 parents 632ac17 + 03e53cb commit 0f46ce8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,15 @@ func TestClient_Close(t *testing.T) {
t.Errorf("close was supposed to fail, but didn't")
}
})
t.Run("close on a nil smtpclient should return nil", func(t *testing.T) {
client, err := NewClient(DefaultHost)
if err != nil {
t.Fatalf("failed to create new client: %s", err)
}
if err = client.Close(); err != nil {
t.Errorf("failed to close the client: %s", err)
}
})
}

func TestClient_DialWithContext(t *testing.T) {
Expand Down

0 comments on commit 0f46ce8

Please sign in to comment.