From: Stefan Kangas Date: Sun, 30 Aug 2020 00:38:22 +0000 (+0200) Subject: Convert manual rmailmm tests to ert X-Git-Tag: emacs-28.0.90~6322 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cb1563f3ca2e0d5b3a3e0384b5c76c4d47587f75;p=emacs.git Convert manual rmailmm tests to ert * test/manual/rmailmm.el: Move from here... * test/lisp/mail/rmailmm-tests.el: ...to here, and convert to ert. --- diff --git a/test/lisp/mail/rmailmm-tests.el b/test/lisp/mail/rmailmm-tests.el new file mode 100644 index 00000000000..645bb96d113 --- /dev/null +++ b/test/lisp/mail/rmailmm-tests.el @@ -0,0 +1,117 @@ +;;; rmailmm-tests.el --- Tests for rmailmm.el -*- lexical-binding:t -*- + +;; Copyright (C) 2006-2020 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; Converted to ert from previous manual tests. + +;; FIXME: Some of these still lack a condition for success. + +;;; Code: + +(require 'ert) +(require 'rmailmm) + +(ert-deftest rmailmm-test-handler () + "Test of a mail using no MIME parts at all." + (let ((mail "To: alex@gnu.org +Content-Type: text/plain; charset=koi8-r +Content-Transfer-Encoding: 8bit +MIME-Version: 1.0 + +\372\304\322\301\327\323\324\327\325\312\324\305\41") + (correct "To: alex@gnu.org +Content-Type: text/plain; charset=koi8-r +Content-Transfer-Encoding: 8bit +MIME-Version: 1.0 + +Здравствуйте! +")) + (with-temp-buffer + (erase-buffer) + (set-buffer-multibyte nil) + (insert mail) + (rmail-mime-show t) + (set-buffer-multibyte t) + (should (equal (buffer-string) correct))))) + +;;;; FIXME: This doesn't seem to be working. +(ert-deftest rmailmm-test-bulk-handler () + "Test of a mail used as an example in RFC 2183." + :tags '(:unstable) + (let ((mail "Content-Type: image/jpeg +Content-Disposition: attachment; filename=genome.jpeg; + modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\"; +Content-Description: a complete map of the human genome +Content-Transfer-Encoding: base64 + +iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAZQ +TFRF////AAAAVcLTfgAAAPZJREFUeNq9ldsOwzAIQ+3//+l1WlvA5ZLsoUiTto4TB+ISoAjy ++ITfRBfcAmgRFFeAm+J6uhdKdFhFWUgDkFsK0oUp/9G2//Kj7Jx+5tSKOdBscgUYiKHRS/me +WATQdRUvAK0Bnmshmtn79PpaLBbbOZkjKvRnjRZoRswOkG1wFchKew2g9wXVJVZL/m4+B+vv +9AxQQR2Q33SgAYJzzVACdAWjAfRYzYFO9n6SLnydtQHSMxYDMAKqZ/8FS/lTK+zuq3CtK64L +UDwbgUEAUmk2Zyg101d6PhCDySgAvTvDgKiuOrc4dLxUb7UMnhGIexyI+d6U+ABuNAP4Simx +lgAAAABJRU5ErkJggg== +")) + (with-temp-buffer + (erase-buffer) + (insert mail) + (rmail-mime-show) + ;; FIXME: What is the condition for success? + ))) + +;; FIXME: Has no condition for success -- see below. +(ert-deftest rmailmm-test-multipart-handler () + "Test of a mail used as an example in RFC 2046." + :tags '(:unstable) + (let ((mail "From: Nathaniel Borenstein +To: Ned Freed +Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST) +Subject: Sample message +MIME-Version: 1.0 +Content-type: multipart/mixed; boundary=\"simple boundary\" + +This is the preamble. It is to be ignored, though it +is a handy place for composition agents to include an +explanatory note to non-MIME conformant readers. + +--simple boundary + +This is implicitly typed plain US-ASCII text. +It does NOT end with a linebreak. +--simple boundary +Content-type: text/plain; charset=us-ascii + +This is explicitly typed plain US-ASCII text. +It DOES end with a linebreak. + +--simple boundary-- + +This is the epilogue. It is also to be ignored.")) + (switch-to-buffer (get-buffer-create "*test*")) + (erase-buffer) + (insert mail) + (rmail-mime-show t) + ;; FIXME: What is the condition for success? + (should nil) ; expected fail for now + )) + +(provide 'rmailmm-tests) + +;; rmailmm-tests.el ends here diff --git a/test/manual/rmailmm.el b/test/manual/rmailmm.el deleted file mode 100644 index d6e29a8b07b..00000000000 --- a/test/manual/rmailmm.el +++ /dev/null @@ -1,93 +0,0 @@ -;;; rmailmm.el --- tests for mail/rmailmm.el - -;; Copyright (C) 2006-2020 Free Software Foundation, Inc. - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;;; Commentary: - -;;; Code: - -(require 'rmailmm) - -(defun rmailmm-test-handler () - "Test of a mail using no MIME parts at all." - (let ((mail "To: alex@gnu.org -Content-Type: text/plain; charset=koi8-r -Content-Transfer-Encoding: 8bit -MIME-Version: 1.0 - -\372\304\322\301\327\323\324\327\325\312\324\305\41")) - (switch-to-buffer (get-buffer-create "*test*")) - (erase-buffer) - (set-buffer-multibyte nil) - (insert mail) - (rmail-mime-show t) - (set-buffer-multibyte t))) - -(defun rmailmm-test-bulk-handler () - "Test of a mail used as an example in RFC 2183." - (let ((mail "Content-Type: image/jpeg -Content-Disposition: attachment; filename=genome.jpeg; - modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\"; -Content-Description: a complete map of the human genome -Content-Transfer-Encoding: base64 - -iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAZQ -TFRF////AAAAVcLTfgAAAPZJREFUeNq9ldsOwzAIQ+3//+l1WlvA5ZLsoUiTto4TB+ISoAjy -+ITfRBfcAmgRFFeAm+J6uhdKdFhFWUgDkFsK0oUp/9G2//Kj7Jx+5tSKOdBscgUYiKHRS/me -WATQdRUvAK0Bnmshmtn79PpaLBbbOZkjKvRnjRZoRswOkG1wFchKew2g9wXVJVZL/m4+B+vv -9AxQQR2Q33SgAYJzzVACdAWjAfRYzYFO9n6SLnydtQHSMxYDMAKqZ/8FS/lTK+zuq3CtK64L -UDwbgUEAUmk2Zyg101d6PhCDySgAvTvDgKiuOrc4dLxUb7UMnhGIexyI+d6U+ABuNAP4Simx -lgAAAABJRU5ErkJggg== -")) - (switch-to-buffer (get-buffer-create "*test*")) - (erase-buffer) - (insert mail) - (rmail-mime-show))) - -(defun rmailmm-test-multipart-handler () - "Test of a mail used as an example in RFC 2046." - (let ((mail "From: Nathaniel Borenstein -To: Ned Freed -Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST) -Subject: Sample message -MIME-Version: 1.0 -Content-type: multipart/mixed; boundary=\"simple boundary\" - -This is the preamble. It is to be ignored, though it -is a handy place for composition agents to include an -explanatory note to non-MIME conformant readers. - ---simple boundary - -This is implicitly typed plain US-ASCII text. -It does NOT end with a linebreak. ---simple boundary -Content-type: text/plain; charset=us-ascii - -This is explicitly typed plain US-ASCII text. -It DOES end with a linebreak. - ---simple boundary-- - -This is the epilogue. It is also to be ignored.")) - (switch-to-buffer (get-buffer-create "*test*")) - (erase-buffer) - (insert mail) - (rmail-mime-show t))) - -;;; rmailmm.el ends here