From ad86c7ac4fb00cb3cd98ba50f71f9211e4a6e231 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Mon, 11 Nov 2024 20:06:07 +0100 Subject: [PATCH 1/4] Correct typo in test name The test name had a typo in the word "recipient." This commit corrects "recepient" to "recipient" to improve code readability and maintain consistency in naming conventions. This change does not modify any functional behavior of the tests. --- client_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client_test.go b/client_test.go index 96ebf1f..39bd7e0 100644 --- a/client_test.go +++ b/client_test.go @@ -2803,7 +2803,7 @@ func TestClient_sendSingleMsg(t *testing.T) { t.Errorf("expected ErrGetSender, got %s", sendErr.Reason) } }) - t.Run("fail with no recepient addresses", func(t *testing.T) { + t.Run("fail with no recipient addresses", func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() PortAdder.Add(1) From 79d4c6fd0708d70861e1083c1a2cc41ba3a1a23b Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Mon, 11 Nov 2024 20:06:47 +0100 Subject: [PATCH 2/4] Correct spelling errors in email validation comments Fixed the spelling of "dot-separated" in comment explanations to ensure clarity. This makes the comments more accurate and easier to understand. --- msg_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/msg_test.go b/msg_test.go index 117e8e7..ce98447 100644 --- a/msg_test.go +++ b/msg_test.go @@ -126,8 +126,8 @@ var ( {`" "@domain.tld`, true}, // Still valid, since quoted {`"<\"@\".!#%$@domain.tld"`, false}, // Quoting with illegal characters is not allowed {`<\"@\\".!#%$@domain.tld`, false}, // Still a bunch of random illegal characters - {`hi"@"there@domain.tld`, false}, // Quotes must be dot-seperated - {`"<\"@\\".!.#%$@domain.tld`, false}, // Quote is escaped and dot-seperated which would be RFC822 compliant, but not RFC5322 compliant + {`hi"@"there@domain.tld`, false}, // Quotes must be dot-separated + {`"<\"@\\".!.#%$@domain.tld`, false}, // Quote is escaped and dot-separated which would be RFC822 compliant, but not RFC5322 compliant {`hi\ there@domain.tld`, false}, // Spaces must be quoted {"hello@tld", true}, // TLD is enough {`你好@域名.顶级域名`, true}, // We speak RFC6532 From c7438a974cf8e3fac2119bec19da28c899907990 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Mon, 11 Nov 2024 20:07:55 +0100 Subject: [PATCH 3/4] Fix typos: change "non-existant" to "non-existent" Corrected multiple instances of the word "non-existant" to "non-existent" in test descriptions to improve code clarity and accuracy. This change affects both smtp_test.go and msg_test.go files. --- msg_test.go | 8 ++++---- smtp/smtp_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/msg_test.go b/msg_test.go index ce98447..3f2cf94 100644 --- a/msg_test.go +++ b/msg_test.go @@ -4527,12 +4527,12 @@ func TestMsg_AttachFile(t *testing.T) { t.Errorf("expected message body to be %s, got: %s", "This is a test attachment", got) } }) - t.Run("AttachFile with non-existant file", func(t *testing.T) { + t.Run("AttachFile with non-existent file", func(t *testing.T) { message := NewMsg() if message == nil { t.Fatal("message is nil") } - message.AttachFile("testdata/non-existant-file.txt") + message.AttachFile("testdata/non-existent-file.txt") attachments := message.GetAttachments() if len(attachments) != 0 { t.Fatalf("failed to retrieve attachments list") @@ -4997,12 +4997,12 @@ func TestMsg_EmbedFile(t *testing.T) { t.Errorf("expected message body to be %s, got: %s", "This is a test embed", got) } }) - t.Run("EmbedFile with non-existant file", func(t *testing.T) { + t.Run("EmbedFile with non-existent file", func(t *testing.T) { message := NewMsg() if message == nil { t.Fatal("message is nil") } - message.EmbedFile("testdata/non-existant-file.txt") + message.EmbedFile("testdata/non-existent-file.txt") embeds := message.GetEmbeds() if len(embeds) != 0 { t.Fatalf("failed to retrieve attachments list") diff --git a/smtp/smtp_test.go b/smtp/smtp_test.go index 931b74e..1b616fc 100644 --- a/smtp/smtp_test.go +++ b/smtp/smtp_test.go @@ -1492,7 +1492,7 @@ func TestNewClient(t *testing.T) { t.Run("new client via Dial fails on server not started", func(t *testing.T) { _, err := Dial(fmt.Sprintf("%s:%d", TestServerAddr, 64000)) if err == nil { - t.Error("dial on non-existant server should fail") + t.Error("dial on non-existent server should fail") } }) t.Run("new client fails on server not available", func(t *testing.T) { From 29794fd6ad5167bdd7d334bec8960dabe77577df Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Mon, 11 Nov 2024 20:08:58 +0100 Subject: [PATCH 4/4] Fix typo in Content-Disposition header in tests Corrected multiple instances of the misspelled "Content-Dispositon" to "Content-Disposition" in the msgwriter_test.go file. This ensures that the error messages in the tests are accurate and improve code readability. --- msgwriter_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/msgwriter_test.go b/msgwriter_test.go index 330507b..1b2a254 100644 --- a/msgwriter_test.go +++ b/msgwriter_test.go @@ -324,7 +324,7 @@ func TestMsgWriter_addFiles(t *testing.T) { } } if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { - t.Errorf("Content-Dispositon header not found for attachment. Mail: %s", buffer.String()) + t.Errorf("Content-Disposition header not found for attachment. Mail: %s", buffer.String()) } switch runtime.GOOS { case "freebsd": @@ -357,7 +357,7 @@ func TestMsgWriter_addFiles(t *testing.T) { } } if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment"`) { - t.Errorf("Content-Dispositon header not found for attachment. Mail: %s", buffer.String()) + t.Errorf("Content-Disposition header not found for attachment. Mail: %s", buffer.String()) } if !strings.Contains(buffer.String(), `Content-Type: application/octet-stream; name="attachment"`) { t.Errorf("Content-Type header not found for attachment. Mail: %s", buffer.String()) @@ -383,7 +383,7 @@ func TestMsgWriter_addFiles(t *testing.T) { } } if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { - t.Errorf("Content-Dispositon header not found for attachment. Mail: %s", buffer.String()) + t.Errorf("Content-Disposition header not found for attachment. Mail: %s", buffer.String()) } if !strings.Contains(buffer.String(), `Content-Type: application/octet-stream; name="attachment.txt"`) { t.Errorf("Content-Type header not found for attachment. Mail: %s", buffer.String()) @@ -402,7 +402,7 @@ func TestMsgWriter_addFiles(t *testing.T) { t.Errorf("attachment not found in mail message. Mail: %s", buffer.String()) } if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { - t.Errorf("Content-Dispositon header not found for attachment. Mail: %s", buffer.String()) + t.Errorf("Content-Disposition header not found for attachment. Mail: %s", buffer.String()) } switch runtime.GOOS { case "freebsd": @@ -438,7 +438,7 @@ func TestMsgWriter_addFiles(t *testing.T) { } } if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { - t.Errorf("Content-Dispositon header not found for attachment. Mail: %s", buffer.String()) + t.Errorf("Content-Disposition header not found for attachment. Mail: %s", buffer.String()) } switch runtime.GOOS { case "freebsd": @@ -478,7 +478,7 @@ func TestMsgWriter_addFiles(t *testing.T) { } } if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { - t.Errorf("Content-Dispositon header not found for attachment. Mail: %s", buffer.String()) + t.Errorf("Content-Disposition header not found for attachment. Mail: %s", buffer.String()) } switch runtime.GOOS { case "freebsd":