diff options
| -rw-r--r-- | test/lisp/gnus/mm-decode-resources/win1252-multipart.bin | 44 | ||||
| -rw-r--r-- | test/lisp/gnus/mm-decode-tests.el | 29 |
2 files changed, 73 insertions, 0 deletions
diff --git a/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin b/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin new file mode 100644 index 00000000000..d3c5026dcce --- /dev/null +++ b/test/lisp/gnus/mm-decode-resources/win1252-multipart.bin | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | To: example <example@example.org> | ||
| 2 | From: example <example@example.org> | ||
| 3 | Date: Tue, 5 Jan 2021 10:30:34 +0100 | ||
| 4 | MIME-Version: 1.0 | ||
| 5 | Content-Type: multipart/mixed; boundary="------------FB569A4368539497CC91D1DC" | ||
| 6 | Content-Language: fr | ||
| 7 | Subject: test | ||
| 8 | |||
| 9 | --------------FB569A4368539497CC91D1DC | ||
| 10 | Content-Type: multipart/alternative; | ||
| 11 | boundary="------------61C81A7DC7592E4C6F856A85" | ||
| 12 | |||
| 13 | |||
| 14 | --------------61C81A7DC7592E4C6F856A85 | ||
| 15 | Content-Type: text/plain; charset=windows-1252; format=flowed | ||
| 16 | Content-Transfer-Encoding: 8bit | ||
| 17 | |||
| 18 | déjà raté | ||
| 19 | |||
| 20 | --------------61C81A7DC7592E4C6F856A85 | ||
| 21 | Content-Type: text/html; charset=windows-1252 | ||
| 22 | Content-Transfer-Encoding: 8bit | ||
| 23 | |||
| 24 | <html> | ||
| 25 | <head> | ||
| 26 | <meta http-equiv="content-type" content="text/html; charset=windows-1252"> | ||
| 27 | </head> | ||
| 28 | <body> | ||
| 29 | déjà raté | ||
| 30 | </body> | ||
| 31 | </html> | ||
| 32 | |||
| 33 | --------------61C81A7DC7592E4C6F856A85-- | ||
| 34 | |||
| 35 | --------------FB569A4368539497CC91D1DC | ||
| 36 | Content-Type: text/plain; charset="us-ascii" | ||
| 37 | MIME-Version: 1.0 | ||
| 38 | Content-Transfer-Encoding: 7bit | ||
| 39 | Content-Disposition: inline | ||
| 40 | |||
| 41 | mailing list signature | ||
| 42 | |||
| 43 | --------------FB569A4368539497CC91D1DC-- | ||
| 44 | |||
diff --git a/test/lisp/gnus/mm-decode-tests.el b/test/lisp/gnus/mm-decode-tests.el index 74591f919da..6e8fae6eaff 100644 --- a/test/lisp/gnus/mm-decode-tests.el +++ b/test/lisp/gnus/mm-decode-tests.el | |||
| @@ -86,4 +86,33 @@ | |||
| 86 | 'charset))) | 86 | 'charset))) |
| 87 | "ääää\n")))))) | 87 | "ääää\n")))))) |
| 88 | 88 | ||
| 89 | (ert-deftest test-mm-dissect-buffer-win1252 () | ||
| 90 | (with-temp-buffer | ||
| 91 | (set-buffer-multibyte nil) | ||
| 92 | (insert-file-contents-literally (ert-resource-file "win1252-multipart.bin")) | ||
| 93 | (let ((handle (mm-dissect-buffer))) | ||
| 94 | (should (equal (mm-handle-media-type handle) "multipart/mixed")) | ||
| 95 | ;; Skip multipart type. | ||
| 96 | (pop handle) | ||
| 97 | (setq handle (car handle)) | ||
| 98 | (pop handle) | ||
| 99 | (let ((part (pop handle))) | ||
| 100 | (should (equal (mm-handle-media-type part) "text/plain")) | ||
| 101 | (should (eq (mm-handle-encoding part) '8bit)) | ||
| 102 | (with-current-buffer (mm-handle-buffer part) | ||
| 103 | (should (equal (decode-coding-string | ||
| 104 | (buffer-string) | ||
| 105 | (intern (mail-content-type-get (mm-handle-type part) | ||
| 106 | 'charset))) | ||
| 107 | "déjà raté\n")))) | ||
| 108 | (let ((part (pop handle))) | ||
| 109 | (should (equal (mm-handle-media-type part) "text/html")) | ||
| 110 | (should (eq (mm-handle-encoding part) '8bit)) | ||
| 111 | (with-current-buffer (mm-handle-buffer part) | ||
| 112 | (should (equal (decode-coding-string | ||
| 113 | (buffer-string) | ||
| 114 | (intern (mail-content-type-get (mm-handle-type part) | ||
| 115 | 'charset))) | ||
| 116 | "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1252\">\n </head>\n <body>\n déjà raté\n </body>\n</html>\n"))))))) | ||
| 117 | |||
| 89 | ;;; mm-decode-tests.el ends here | 118 | ;;; mm-decode-tests.el ends here |