From ea3da3ace5b1cc9050f89de6a801240d0864987e Mon Sep 17 00:00:00 2001 From: Mario Hros Date: Sat, 26 Aug 2023 17:15:47 +0200 Subject: [PATCH] add test cases for base64 (from ryotosaito:master #24) --- parsemail_test.go | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/parsemail_test.go b/parsemail_test.go index 281437f..cf4483c 100644 --- a/parsemail_test.go +++ b/parsemail_test.go @@ -503,6 +503,31 @@ So, "Hello".`, htmlBody: rfc2045exampleBhtml, textBody: "Time for the egg. Should we hardboil the egg or fry it. We can scramble it or poach it.", }, + 18: { + contentType: "multipart/alternative; boundary=\"000000000000ab2e1f05a26de586\"", + mailData: base64Content, + subject: "Saying Hello", + from: []mail.Address{ + { + Name: "John Doe", + Address: "jdoe@machine.example", + }, + }, + sender: mail.Address{ + Name: "Michael Jones", + Address: "mjones@machine.example", + }, + to: []mail.Address{ + { + Name: "Mary Smith", + Address: "mary@example.net", + }, + }, + messageID: "1234@local.machine.example", + date: parseDate("Fri, 21 Nov 1997 09:55:06 -0600"), + htmlBody: "
👍
", + textBody: "👍", + }, } for index, td := range testData { @@ -1310,3 +1335,26 @@ t. --000000000000ab2e2205a26de587-- ` +var base64Content = `MIME-Version: 1.0 +From: John Doe +Sender: Michael Jones +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> +Content-Type: multipart/alternative; boundary="000000000000ab2e1f05a26de586" + +--000000000000ab2e1f05a26de586 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: base64 + +8J+RjQo= + +--000000000000ab2e1f05a26de586 +Content-Type: text/html; charset="UTF-8" +Content-Transfer-Encoding: base64 + +PGRpdiBkaXI9Imx0ciI+8J+RjTwvZGl2Pgo= + +--000000000000ab2e1f05a26de586-- +`