diff options
| author | Lars Ingebrigtsen | 2019-07-12 15:59:27 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-12 15:59:27 +0200 |
| commit | 4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e (patch) | |
| tree | 7e6582f588f85620bc579be4a3e001d56996f208 /test/lisp | |
| parent | 4438459eaa6cccdac2cfcc8f7d5f248bfe8d1edf (diff) | |
| download | emacs-4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e.tar.gz emacs-4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e.zip | |
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')
| -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 @@ | |||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'rfc2047) | 23 | (require 'rfc2047) |
| 24 | 24 | ||
| 25 | (ert-deftest test-rfc2047-fold-short () | 25 | (defun test-rfc2047 (before after) |
| 26 | (with-temp-buffer | 26 | (with-temp-buffer |
| 27 | (insert "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of Short Words Here\n") | 27 | (insert before) |
| 28 | (goto-char (point-min)) | 28 | (goto-char (point-min)) |
| 29 | (rfc2047-fold-field) | 29 | (rfc2047-fold-field) |
| 30 | (should (equal (buffer-string) | 30 | (should (equal (buffer-string) after)))) |
| 31 | "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of | 31 | |
| 32 | (ert-deftest test-rfc2047-fold-short () | ||
| 33 | (test-rfc2047 | ||
| 34 | "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of Short Words Here\n" | ||
| 35 | |||
| 36 | "Organization: Lots Of Short Words Here Lots Of Short Words Here Lots Of | ||
| 32 | Short Words Here | 37 | Short Words Here |
| 33 | ")))) | 38 | ")) |
| 34 | 39 | ||
| 35 | (ert-deftest test-rfc2047-fold-encoded () | 40 | (ert-deftest test-rfc2047-fold-encoded () |
| 36 | (with-temp-buffer | 41 | (test-rfc2047 |
| 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") | 42 | "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)) | 43 | "Subject: This is =?utf-8?Q?=C3=A1?= long subject that's |
| 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 | 44 | =?utf-8?Q?v=C3=A9ry?= long and =?utf-8?Q?ver=C3=BD?= encoded yes indeed it |
| 43 | =?utf-8?Q?=C3=ADs?= | 45 | =?utf-8?Q?=C3=ADs?= |
| 44 | ")))) | 46 | ")) |
| 47 | |||
| 48 | (ert-deftest test-rfc2047-fold-long () | ||
| 49 | (test-rfc2047 | ||
| 50 | "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword and then\n" | ||
| 51 | "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword | ||
| 52 | and then | ||
| 53 | ")) | ||
| 54 | |||
| 55 | (ert-deftest test-rfc2047-fold-long-short () | ||
| 56 | (test-rfc2047 | ||
| 57 | "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword\n" | ||
| 58 | "Organization: verylongverylongverylongverylongverylongverylongverylongverylongverylongword\n")) | ||
| 45 | 59 | ||
| 46 | ;;; rfc2047-tests.el ends here | 60 | ;;; rfc2047-tests.el ends here |