From 990d2ad13da10b31890febf10d0b51b084caef0b Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Tue, 12 Mar 2024 12:16:52 +0530 Subject: [PATCH] Add tests for None encoding for headers --- email.go | 1 + header_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/email.go b/email.go index 0a109ce..4c2a469 100644 --- a/email.go +++ b/email.go @@ -115,6 +115,7 @@ type headerEncoding int const ( // HeaderEncodingNone turns off encoding on the message headers + // https://www.rfc-editor.org/rfc/rfc6530#section-7.1 HeaderEncodingNone headerEncoding = iota // TODO: Add Base64 encoding diff --git a/header_test.go b/header_test.go index a2c2c78..1401537 100644 --- a/header_test.go +++ b/header_test.go @@ -103,6 +103,12 @@ func testWriter(t *testing.T, binary bool) { {utf8, qp, 70, "Lorem ipsum dolor sit amet consectetuer Sed morbi ut pharetra quis. Parturient tincidunt nibh tellus metus pellentesque semper laoreet In tempor sed. Sed in Vestibulum augue vitae Vivamus faucibus ac suscipit accumsan gravida. Et fringilla convallis quis tincidunt convallis urna adipiscing eros nunc porttitor. Ipsum id nisl leo Curabitur purus Cum Vestibulum nunc purus tortor.", "Lorem\r\n ipsum dolor sit amet consectetuer Sed morbi ut pharetra quis. Parturient\r\n tincidunt nibh tellus metus pellentesque semper laoreet In tempor sed. Sed\r\n in Vestibulum augue vitae Vivamus faucibus ac suscipit accumsan gravida. Et\r\n fringilla convallis quis tincidunt convallis urna adipiscing eros nunc\r\n porttitor. Ipsum id nisl leo Curabitur purus Cum Vestibulum nunc purus\r\n tortor."}, {utf8, qp, 71, "Lorem ipsum dolor sit amet consectetuer Sed morbi ut pharetra quis. Parturient tincidunt nibh tellus metus pellentesque semper laoreet In tempor sed. Sed in Vestibulum augue vitae Vivamus faucibus ac suscipit accumsan gravida. Et fringilla convallis quis tincidunt convallis urna adipiscing eros nunc porttitor. Ipsum id nisl leo Curabitur purus Cum Vestibulum nunc purus tortor.", "Lorem\r\n ipsum dolor sit amet consectetuer Sed morbi ut pharetra quis. Parturient\r\n tincidunt nibh tellus metus pellentesque semper laoreet In tempor sed. Sed\r\n in Vestibulum augue vitae Vivamus faucibus ac suscipit accumsan gravida. Et\r\n fringilla convallis quis tincidunt convallis urna adipiscing eros nunc\r\n porttitor. Ipsum id nisl leo Curabitur purus Cum Vestibulum nunc purus\r\n tortor."}, {utf8, qp, 72, "Lorem ipsum dolor sit amet consectetuer Sed morbi ut pharetra quis. Parturient tincidunt nibh tellus metus pellentesque semper laoreet In tempor sed. Sed in Vestibulum augue vitae Vivamus faucibus ac suscipit accumsan gravida. Et fringilla convallis quis tincidunt convallis urna adipiscing eros nunc porttitor. Ipsum id nisl leo Curabitur purus Cum Vestibulum nunc purus tortor.", "\r\n Lorem ipsum dolor sit amet consectetuer Sed morbi ut pharetra quis.\r\n Parturient tincidunt nibh tellus metus pellentesque semper laoreet In\r\n tempor sed. Sed in Vestibulum augue vitae Vivamus faucibus ac suscipit\r\n accumsan gravida. Et fringilla convallis quis tincidunt convallis urna\r\n adipiscing eros nunc porttitor. Ipsum id nisl leo Curabitur purus Cum\r\n Vestibulum nunc purus tortor."}, + + {utf8, HeaderEncodingNone, 0, "日本語テキストです。", "日本語テキストです。"}, + {utf8, HeaderEncodingNone, 0, "漢字、カタカナ、ひらがなを含む、非常に長いタイトル行が一体全体どのようにしてEncodeされるのか?", "漢字、カタカナ、ひらがなを含む、非常に長いタイトル行が一体全体どのようにしてEncodeされるのか?"}, + {utf8, HeaderEncodingNone, 0, "dankogai@dan.co.jp (小飼=Kogai, 弾=Dan)", "dankogai@dan.co.jp (小飼=Kogai, 弾=Dan)"}, + {utf8, HeaderEncodingNone, 50, "dankogai@dan.co.jp (小飼=Kogai, 弾=Dan)", "dankogai@dan.co.jp\r\n (小飼=Kogai, 弾=Dan)"}, + {utf8, HeaderEncodingNone, 0, "Αυτό είναι ελληνικό κείμενο. 0123456789.", "Αυτό είναι ελληνικό κείμενο. 0123456789."}, } for _, test := range tests {