rmailmm.el 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ;;; rmailmm.el --- tests for mail/rmailmm.el
  2. ;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
  3. ;; This file is part of GNU Emacs.
  4. ;; GNU Emacs is free software: you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;; GNU Emacs is distributed in the hope that it will be useful,
  9. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. ;; GNU General Public License for more details.
  12. ;; You should have received a copy of the GNU General Public License
  13. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  14. ;;; Commentary:
  15. ;;; Code:
  16. (require 'rmailmm)
  17. (defun rmailmm-test-handler ()
  18. "Test of a mail using no MIME parts at all."
  19. (let ((mail "To: alex@gnu.org
  20. Content-Type: text/plain; charset=koi8-r
  21. Content-Transfer-Encoding: 8bit
  22. MIME-Version: 1.0
  23. \372\304\322\301\327\323\324\327\325\312\324\305\41"))
  24. (switch-to-buffer (get-buffer-create "*test*"))
  25. (erase-buffer)
  26. (set-buffer-multibyte nil)
  27. (insert mail)
  28. (rmail-mime-show t)
  29. (set-buffer-multibyte t)))
  30. (defun rmailmm-test-bulk-handler ()
  31. "Test of a mail used as an example in RFC 2183."
  32. (let ((mail "Content-Type: image/jpeg
  33. Content-Disposition: attachment; filename=genome.jpeg;
  34. modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\";
  35. Content-Description: a complete map of the human genome
  36. Content-Transfer-Encoding: base64
  37. iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAZQ
  38. TFRF////AAAAVcLTfgAAAPZJREFUeNq9ldsOwzAIQ+3//+l1WlvA5ZLsoUiTto4TB+ISoAjy
  39. +ITfRBfcAmgRFFeAm+J6uhdKdFhFWUgDkFsK0oUp/9G2//Kj7Jx+5tSKOdBscgUYiKHRS/me
  40. WATQdRUvAK0Bnmshmtn79PpaLBbbOZkjKvRnjRZoRswOkG1wFchKew2g9wXVJVZL/m4+B+vv
  41. 9AxQQR2Q33SgAYJzzVACdAWjAfRYzYFO9n6SLnydtQHSMxYDMAKqZ/8FS/lTK+zuq3CtK64L
  42. UDwbgUEAUmk2Zyg101d6PhCDySgAvTvDgKiuOrc4dLxUb7UMnhGIexyI+d6U+ABuNAP4Simx
  43. lgAAAABJRU5ErkJggg==
  44. "))
  45. (switch-to-buffer (get-buffer-create "*test*"))
  46. (erase-buffer)
  47. (insert mail)
  48. (rmail-mime-show)))
  49. (defun rmailmm-test-multipart-handler ()
  50. "Test of a mail used as an example in RFC 2046."
  51. (let ((mail "From: Nathaniel Borenstein <nsb@bellcore.com>
  52. To: Ned Freed <ned@innosoft.com>
  53. Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST)
  54. Subject: Sample message
  55. MIME-Version: 1.0
  56. Content-type: multipart/mixed; boundary=\"simple boundary\"
  57. This is the preamble. It is to be ignored, though it
  58. is a handy place for composition agents to include an
  59. explanatory note to non-MIME conformant readers.
  60. --simple boundary
  61. This is implicitly typed plain US-ASCII text.
  62. It does NOT end with a linebreak.
  63. --simple boundary
  64. Content-type: text/plain; charset=us-ascii
  65. This is explicitly typed plain US-ASCII text.
  66. It DOES end with a linebreak.
  67. --simple boundary--
  68. This is the epilogue. It is also to be ignored."))
  69. (switch-to-buffer (get-buffer-create "*test*"))
  70. (erase-buffer)
  71. (insert mail)
  72. (rmail-mime-show t)))
  73. ;;; rmailmm.el ends here