diff options
| author | Pengji Zhang | 2024-08-28 19:11:35 +0800 |
|---|---|---|
| committer | Eli Zaretskii | 2024-10-12 15:30:05 +0300 |
| commit | c3600916b6942b2a9797ec2248d29cb337c7c6fa (patch) | |
| tree | 0b09b0fffab1f63725b17b7e482a4d7f461e9781 /test | |
| parent | fc214b668391abed313920cd44f3d913c8207e0e (diff) | |
| download | emacs-c3600916b6942b2a9797ec2248d29cb337c7c6fa.tar.gz emacs-c3600916b6942b2a9797ec2248d29cb337c7c6fa.zip | |
Improve tests for flow-fill
* test/lisp/mail/flow-fill-tests.el
(fill-flow-tests-fill-flowed-decode): Remove debug message.
(fill-flow-tests-fill-flowed-encode): Actually test function
`fill-flowed-encode', which requires `use-hard-newline' to be
non-nil. Also adjust test input to check behavior of the
function under different cases. (Bug#72870)
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/mail/flow-fill-tests.el | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/test/lisp/mail/flow-fill-tests.el b/test/lisp/mail/flow-fill-tests.el index 1f698f538f3..50fbb1e7f80 100644 --- a/test/lisp/mail/flow-fill-tests.el +++ b/test/lisp/mail/flow-fill-tests.el | |||
| @@ -54,37 +54,43 @@ | |||
| 54 | (with-temp-buffer | 54 | (with-temp-buffer |
| 55 | (insert input) | 55 | (insert input) |
| 56 | (fill-flowed) | 56 | (fill-flowed) |
| 57 | (message "foo") | ||
| 58 | (should (equal (buffer-string) output))))) | 57 | (should (equal (buffer-string) output))))) |
| 59 | 58 | ||
| 60 | (ert-deftest fill-flow-tests-fill-flowed-encode () | 59 | (ert-deftest fill-flow-tests-fill-flowed-encode () |
| 61 | (let ((input | 60 | (let ((input |
| 62 | (concat | 61 | (concat |
| 63 | "> Thou villainous ill-breeding spongy dizzy-eyed \n" | 62 | ;; Hard newline in the middle of a level |
| 64 | "> reeky elf-skinned pigeon-egg! \n" | 63 | "> Thou villainous ill-breeding spongy dizzy-eyed" hard-newline |
| 65 | ">> Thou artless swag-bellied milk-livered \n" | 64 | "> reeky elf-skinned pigeon-egg!\n" |
| 66 | ">> dismal-dreaming idle-headed scut!\n" | 65 | ">> Thou artless swag-bellied milk-livered\n" |
| 66 | ;; Hard new line at the end of a level | ||
| 67 | ">> dismal-dreaming idle-headed scut!" hard-newline | ||
| 68 | ;; Trailing space should be preserved after filling | ||
| 67 | ">>> Thou errant folly-fallen spleeny reeling-ripe \n" | 69 | ">>> Thou errant folly-fallen spleeny reeling-ripe \n" |
| 68 | ">>> unmuzzled ratsbane!\n" | 70 | ">>> unmuzzled ratsbane!\n" |
| 69 | ">>>> Henceforth, the coding style is to be strictly \n" | 71 | ">>>> Henceforth, the coding style is to be strictly\n" |
| 70 | ">>>> enforced, including the use of only upper case.\n" | 72 | ">>>> enforced, including the use of only upper case.\n" |
| 71 | ">>>>> I've noticed a lack of adherence to the coding \n" | 73 | ;; Consecutive hard newlines within a level |
| 74 | ">>>>> I've noticed a lack of adherence to" hard-newline | ||
| 75 | ">>>>> the coding" hard-newline | ||
| 72 | ">>>>> styles, of late.\n" | 76 | ">>>>> styles, of late.\n" |
| 73 | ">>>>>> Any complaints?\n")) | 77 | ">>>>>> Any complaints?\n")) |
| 74 | (output | 78 | (output |
| 75 | (concat | 79 | (concat |
| 76 | "> Thou villainous ill-breeding spongy dizzy-eyed \n" | 80 | "> Thou villainous ill-breeding spongy dizzy-eyed\n" |
| 77 | "> reeky elf-skinned pigeon-egg! \n" | 81 | "> reeky elf-skinned pigeon-egg! \n" |
| 78 | ">> Thou artless swag-bellied milk-livered \n" | 82 | ">> Thou artless swag-bellied milk-livered dismal-dreaming \n" |
| 79 | ">> dismal-dreaming idle-headed scut!\n" | 83 | ">> idle-headed scut!\n" |
| 80 | ">>> Thou errant folly-fallen spleeny reeling-ripe \n" | 84 | ">>> Thou errant folly-fallen spleeny reeling-ripe unmuzzled \n" |
| 81 | ">>> unmuzzled ratsbane!\n" | 85 | ">>> ratsbane! \n" |
| 82 | ">>>> Henceforth, the coding style is to be strictly \n" | 86 | ">>>> Henceforth, the coding style is to be strictly enforced, \n" |
| 83 | ">>>> enforced, including the use of only upper case.\n" | 87 | ">>>> including the use of only upper case. \n" |
| 84 | ">>>>> I've noticed a lack of adherence to the coding \n" | 88 | ">>>>> I've noticed a lack of adherence to\n" |
| 85 | ">>>>> styles, of late.\n" | 89 | ">>>>> the coding\n" |
| 86 | ">>>>>> Any complaints?\n")) | 90 | ">>>>> styles, of late. \n" |
| 87 | (fill-flowed-display-column 69)) | 91 | ">>>>>> Any complaints? \n")) |
| 92 | (use-hard-newlines t) | ||
| 93 | (fill-flowed-encode-column 66)) | ||
| 88 | (with-temp-buffer | 94 | (with-temp-buffer |
| 89 | (insert input) | 95 | (insert input) |
| 90 | (fill-flowed-encode) | 96 | (fill-flowed-encode) |