diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2019-07-12 15:59:27 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2019-07-12 15:59:27 +0200 |
commit | 4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e (patch) | |
tree | 7e6582f588f85620bc579be4a3e001d56996f208 /test/lisp/mail | |
parent | 4438459eaa6cccdac2cfcc8f7d5f248bfe8d1edf (diff) | |
download | emacs-4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e.tar.gz |
Fix breaking of rfc2047 headers with long words
* lisp/mail/rfc2047.el (rfc2047-fold-region): Don't break lines
right after the Header: field, but wait until the next
whitespace. (This only makes a difference for words that are very
long (i.e., longer than, say, 60 characters, depending on the
header name length.)
Diffstat (limited to 'test/lisp/mail')
-rw-r--r-- | test/lisp/mail/rfc2047-tests.el | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/test/lisp/mail/rfc2047-tests.el b/test/lisp/mail/rfc2047-tests.el index 8f7b345e71e..bfaf9958917 100644 --- a/test/lisp/mail/rfc2047-tests.el +++ b/test/lisp/mail/rfc2047-tests.el @@ -22,25 +22,39 @@ (require 'ert) (require 'rfc2047) -(ert-deftest test-rfc2047-fold-short () +(defun test-rfc2047 (before after) (with-temp-buffer - (insert "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of Short Words Here\n") + (insert before) (goto-char (point-min)) (rfc2047-fold-field) - (should (equal (buffer-string) - "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of + (should (equal (buffer-string) after)))) + +(ert-deftest test-rfc2047-fold-short () + (test-rfc2047 + "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of Short Words Here\n" + + "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of Short Words Here -")))) +")) (ert-deftest test-rfc2047-fold-encoded () - (with-temp-buffer - (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") - (goto-char (point-min)) - (rfc2047-fold-field) - (should (equal (buffer-string) - "Subject: This is =?utf-8?Q?=C3=A1?= long subject that's + (test-rfc2047 + "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" + "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?= -")))) +")) + +(ert-deftest test-rfc2047-fold-long () + (test-rfc2047 + "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword and then\n" + "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword + and then +")) + +(ert-deftest test-rfc2047-fold-long-short () + (test-rfc2047 + "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword\n" + "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword\n")) ;;; rfc2047-tests.el ends here |