diff options
Diffstat (limited to 'test/lisp/gnus/mm-decode-tests.el')
-rw-r--r-- | test/lisp/gnus/mm-decode-tests.el | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/test/lisp/gnus/mm-decode-tests.el b/test/lisp/gnus/mm-decode-tests.el index 74591f919da..7d059cb3f87 100644 --- a/test/lisp/gnus/mm-decode-tests.el +++ b/test/lisp/gnus/mm-decode-tests.el @@ -70,20 +70,33 @@ 'charset))) "ääää\n")))))) -(ert-deftest test-mm-with-part-multibyte () +(ert-deftest test-mm-dissect-buffer-win1252 () (with-temp-buffer - (set-buffer-multibyte t) - (nnheader-insert-file-contents (ert-resource-file "8bit-multipart.bin")) - (while (search-forward "\r\n" nil t) - (replace-match "\n")) + (set-buffer-multibyte nil) + (insert-file-contents-literally (ert-resource-file "win1252-multipart.bin")) (let ((handle (mm-dissect-buffer))) + (should (equal (mm-handle-media-type handle) "multipart/mixed")) + ;; Skip multipart type. + (pop handle) + (setq handle (car handle)) (pop handle) (let ((part (pop handle))) - (should (equal (decode-coding-string - (mm-with-part part - (buffer-string)) - (intern (mail-content-type-get (mm-handle-type part) - 'charset))) - "ääää\n")))))) + (should (equal (mm-handle-media-type part) "text/plain")) + (should (eq (mm-handle-encoding part) '8bit)) + (with-current-buffer (mm-handle-buffer part) + (should (equal (decode-coding-string + (buffer-string) + (intern (mail-content-type-get (mm-handle-type part) + 'charset))) + "déjà raté\n")))) + (let ((part (pop handle))) + (should (equal (mm-handle-media-type part) "text/html")) + (should (eq (mm-handle-encoding part) '8bit)) + (with-current-buffer (mm-handle-buffer part) + (should (equal (decode-coding-string + (buffer-string) + (intern (mail-content-type-get (mm-handle-type part) + 'charset))) + "<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"))))))) ;;; mm-decode-tests.el ends here |