aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2020-04-26 01:27:23 +0200
committerStefan Kangas2020-04-26 11:02:23 +0200
commit5e4fc5b69b28ef1a7f7f39d0b11c2b509fe9c1d6 (patch)
tree483d2f34294db4796ce4153dc145353066a3ee0d
parent24849c1b8d348379203c07c400bedfd42059963f (diff)
downloademacs-5e4fc5b69b28ef1a7f7f39d0b11c2b509fe9c1d6.tar.gz
emacs-5e4fc5b69b28ef1a7f7f39d0b11c2b509fe9c1d6.zip
Use lexical-binding for rfc2045.el and add tests
* lisp/mail/rfc2045.el: Use-lexical-binding. * test/lisp/mail/rfc2045-tests.el: New file.
-rw-r--r--lisp/mail/rfc2045.el2
-rw-r--r--test/lisp/mail/rfc2045-tests.el36
2 files changed, 37 insertions, 1 deletions
diff --git a/lisp/mail/rfc2045.el b/lisp/mail/rfc2045.el
index 7d962ea2348..dba9c04cc83 100644
--- a/lisp/mail/rfc2045.el
+++ b/lisp/mail/rfc2045.el
@@ -1,4 +1,4 @@
1;;; rfc2045.el --- Functions for decoding rfc2045 headers 1;;; rfc2045.el --- Functions for decoding rfc2045 headers -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1998-2020 Free Software Foundation, Inc. 3;; Copyright (C) 1998-2020 Free Software Foundation, Inc.
4 4
diff --git a/test/lisp/mail/rfc2045-tests.el b/test/lisp/mail/rfc2045-tests.el
new file mode 100644
index 00000000000..844b16a1d93
--- /dev/null
+++ b/test/lisp/mail/rfc2045-tests.el
@@ -0,0 +1,36 @@
1;;; rfc2045-tests.el --- Tests for rfc2045.el -*- lexical-binding:t -*-
2
3;; Copyright (C) 2020 Free Software Foundation, Inc.
4
5;; Author: Stefan Kangas <stefankangas@gmail.com>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;;; Code:
25
26(require 'ert)
27
28(ert-deftest rfc2045-test-encode-string ()
29 (should (equal (rfc2045-encode-string "foo" "bar") "foo=bar"))
30 (should (equal (rfc2045-encode-string "foo" "bar-baz") "foo=bar-baz"))
31 (should (equal (rfc2045-encode-string "foo" "bar baz") "foo=\"bar baz\""))
32 (should (equal (rfc2045-encode-string "foo" "bar\tbaz") "foo=\"bar\tbaz\""))
33 (should (equal (rfc2045-encode-string "foo" "bar\nbaz") "foo=\"bar\nbaz\"")))
34
35(provide 'rfc2045-tests)
36;;; rfc2045-tests.el ends here