Skip to content

Commit ae43a1e

Browse files
author
Mario Hros
committed
add test cases for base64 (from ryotosaito:master DusanKasan#24)
1 parent 00326d4 commit ae43a1e

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

parsemail_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,31 @@ So, "Hello".`,
503503
htmlBody: rfc2045exampleBhtml,
504504
textBody: "Time for the egg. Should we hardboil the egg or fry it. We can scramble it or poach it.",
505505
},
506+
18: {
507+
contentType: "multipart/alternative; boundary=\"000000000000ab2e1f05a26de586\"",
508+
mailData: base64Content,
509+
subject: "Saying Hello",
510+
from: []mail.Address{
511+
{
512+
Name: "John Doe",
513+
Address: "jdoe@machine.example",
514+
},
515+
},
516+
sender: mail.Address{
517+
Name: "Michael Jones",
518+
Address: "mjones@machine.example",
519+
},
520+
to: []mail.Address{
521+
{
522+
Name: "Mary Smith",
523+
Address: "mary@example.net",
524+
},
525+
},
526+
messageID: "1234@local.machine.example",
527+
date: parseDate("Fri, 21 Nov 1997 09:55:06 -0600"),
528+
htmlBody: "<div dir=\"ltr\">👍</div>",
529+
textBody: "👍",
530+
},
506531
}
507532

508533
for index, td := range testData {
@@ -1310,3 +1335,26 @@ t.</div>
13101335
13111336
--000000000000ab2e2205a26de587--
13121337
`
1338+
var base64Content = `MIME-Version: 1.0
1339+
From: John Doe <jdoe@machine.example>
1340+
Sender: Michael Jones <mjones@machine.example>
1341+
To: Mary Smith <mary@example.net>
1342+
Subject: Saying Hello
1343+
Date: Fri, 21 Nov 1997 09:55:06 -0600
1344+
Message-ID: <1234@local.machine.example>
1345+
Content-Type: multipart/alternative; boundary="000000000000ab2e1f05a26de586"
1346+
1347+
--000000000000ab2e1f05a26de586
1348+
Content-Type: text/plain; charset="UTF-8"
1349+
Content-Transfer-Encoding: base64
1350+
1351+
8J+RjQo=
1352+
1353+
--000000000000ab2e1f05a26de586
1354+
Content-Type: text/html; charset="UTF-8"
1355+
Content-Transfer-Encoding: base64
1356+
1357+
PGRpdiBkaXI9Imx0ciI+8J+RjTwvZGl2Pgo=
1358+
1359+
--000000000000ab2e1f05a26de586--
1360+
`

0 commit comments

Comments
 (0)