Merge pull request #362 from wneessen/fix-spelling

Fix spelling in some tests
This commit is contained in:
Winni Neessen 2024-11-11 20:12:46 +01:00 committed by GitHub
commit 26f1ed3102
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 14 deletions

View file

@ -2803,7 +2803,7 @@ func TestClient_sendSingleMsg(t *testing.T) {
t.Errorf("expected ErrGetSender, got %s", sendErr.Reason) 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()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
PortAdder.Add(1) PortAdder.Add(1)

View file

@ -126,8 +126,8 @@ var (
{`" "@domain.tld`, true}, // Still valid, since quoted {`" "@domain.tld`, true}, // Still valid, since quoted
{`"<\"@\".!#%$@domain.tld"`, false}, // Quoting with illegal characters is not allowed {`"<\"@\".!#%$@domain.tld"`, false}, // Quoting with illegal characters is not allowed
{`<\"@\\".!#%$@domain.tld`, false}, // Still a bunch of random illegal characters {`<\"@\\".!#%$@domain.tld`, false}, // Still a bunch of random illegal characters
{`hi"@"there@domain.tld`, false}, // Quotes must be dot-seperated {`hi"@"there@domain.tld`, false}, // Quotes must be dot-separated
{`"<\"@\\".!.#%$@domain.tld`, false}, // Quote is escaped and dot-seperated which would be RFC822 compliant, but not RFC5322 compliant {`"<\"@\\".!.#%$@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 {`hi\ there@domain.tld`, false}, // Spaces must be quoted
{"hello@tld", true}, // TLD is enough {"hello@tld", true}, // TLD is enough
{`你好@域名.顶级域名`, true}, // We speak RFC6532 {`你好@域名.顶级域名`, true}, // We speak RFC6532
@ -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.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() message := NewMsg()
if message == nil { if message == nil {
t.Fatal("message is nil") t.Fatal("message is nil")
} }
message.AttachFile("testdata/non-existant-file.txt") message.AttachFile("testdata/non-existent-file.txt")
attachments := message.GetAttachments() attachments := message.GetAttachments()
if len(attachments) != 0 { if len(attachments) != 0 {
t.Fatalf("failed to retrieve attachments list") 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.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() message := NewMsg()
if message == nil { if message == nil {
t.Fatal("message is nil") t.Fatal("message is nil")
} }
message.EmbedFile("testdata/non-existant-file.txt") message.EmbedFile("testdata/non-existent-file.txt")
embeds := message.GetEmbeds() embeds := message.GetEmbeds()
if len(embeds) != 0 { if len(embeds) != 0 {
t.Fatalf("failed to retrieve attachments list") t.Fatalf("failed to retrieve attachments list")

View file

@ -324,7 +324,7 @@ func TestMsgWriter_addFiles(t *testing.T) {
} }
} }
if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { 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 { switch runtime.GOOS {
case "freebsd": case "freebsd":
@ -357,7 +357,7 @@ func TestMsgWriter_addFiles(t *testing.T) {
} }
} }
if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment"`) { 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"`) { 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()) 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"`) { 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"`) { 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()) 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()) t.Errorf("attachment not found in mail message. Mail: %s", buffer.String())
} }
if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { 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 { switch runtime.GOOS {
case "freebsd": case "freebsd":
@ -438,7 +438,7 @@ func TestMsgWriter_addFiles(t *testing.T) {
} }
} }
if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { 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 { switch runtime.GOOS {
case "freebsd": case "freebsd":
@ -478,7 +478,7 @@ func TestMsgWriter_addFiles(t *testing.T) {
} }
} }
if !strings.Contains(buffer.String(), `Content-Disposition: attachment; filename="attachment.txt"`) { 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 { switch runtime.GOOS {
case "freebsd": case "freebsd":

View file

@ -1492,7 +1492,7 @@ func TestNewClient(t *testing.T) {
t.Run("new client via Dial fails on server not started", func(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)) _, err := Dial(fmt.Sprintf("%s:%d", TestServerAddr, 64000))
if err == nil { 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) { t.Run("new client fails on server not available", func(t *testing.T) {