aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-07-12 15:48:34 +0200
committerLars Ingebrigtsen2019-07-12 15:48:34 +0200
commit4438459eaa6cccdac2cfcc8f7d5f248bfe8d1edf (patch)
treec27964fd802ef038874eef5dd38a773f61dee16c /test
parentc281b9a121a251b19e3e90b67ca85fbe834b3bc2 (diff)
downloademacs-4438459eaa6cccdac2cfcc8f7d5f248bfe8d1edf.tar.gz
emacs-4438459eaa6cccdac2cfcc8f7d5f248bfe8d1edf.zip
Refactor rfc2047-fold-region slightly and add a couple of tests
* lisp/mail/rfc2047.el (rfc2047--break-line): Refactor out to avoid code repetition... (rfc2047-fold-region): ... from this function.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/mail/rfc2047-tests.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/lisp/mail/rfc2047-tests.el b/test/lisp/mail/rfc2047-tests.el
new file mode 100644
index 00000000000..8f7b345e71e
--- /dev/null
+++ b/test/lisp/mail/rfc2047-tests.el
@@ -0,0 +1,46 @@
1;;; rfc2047-tests.el --- tests for rfc2047.el -*- lexical-binding: t -*-
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
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.
11
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.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23(require 'rfc2047)
24
25(ert-deftest test-rfc2047-fold-short ()
26 (with-temp-buffer
27 (insert "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of Short Words Here\n")
28 (goto-char (point-min))
29 (rfc2047-fold-field)
30 (should (equal (buffer-string)
31 "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of
32 Short Words Here
33"))))
34
35(ert-deftest test-rfc2047-fold-encoded ()
36 (with-temp-buffer
37 (insert "Subject: This is =?utf-8?Q?=C3=A1?= long subject that's =?utf-8?Q?v=C3=A9ry?= long and =?utf-8?Q?ver=C3=BD?= encoded yes indeed it =?utf-8?Q?=C3=ADs?=\n")
38 (goto-char (point-min))
39 (rfc2047-fold-field)
40 (should (equal (buffer-string)
41 "Subject: This is =?utf-8?Q?=C3=A1?= long subject that's
42 =?utf-8?Q?v=C3=A9ry?= long and =?utf-8?Q?ver=C3=BD?= encoded yes indeed it
43 =?utf-8?Q?=C3=ADs?=
44"))))
45
46;;; rfc2047-tests.el ends here