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