summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@red-bean.com>2023-01-15 13:40:15 -0800
committerGitHub <noreply@github.com>2023-01-15 13:40:15 -0800
commit22fff6a049402584e7120146c3db141c6f530bf6 (patch)
treef5c6e2d8623ef836f3b57c6af0801b7d1657acf2
parentc12348e40531fc7e7325368621a0e5f8031d99b2 (diff)
parent673a322a1f9dbbe60fc2a0c856e0a9f72e0a58f8 (diff)
downloadrust-mode-22fff6a049402584e7120146c3db141c6f530bf6.tar.gz
Merge pull request #488 from jimblandy/fill-variables
Establish more-controlled environment for fill-paragraph tests.
-rw-r--r--rust-mode-tests.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 978941d..c1d0501 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -54,6 +54,13 @@
(should (rust-compare-code-after-manip
original point-pos manip-func expected (buffer-string)))))
+(defmacro rust-test-with-standard-fill-settings (&rest body)
+ (declare (indent defun))
+ `(let ((fill-column rust-test-fill-column)
+ (sentence-end-double-space t)
+ (colon-double-space nil))
+ ,@body))
+
(defun rust-test-fill-paragraph (unfilled expected &optional start-pos end-pos)
"We're going to run through many scenarios here--the point should be able to be anywhere from the start-pos (defaults to 1) through end-pos (defaults to the length of what was passed in) and (fill-paragraph) should return the same result. It should also work with fill-region from start-pos to end-pos.
@@ -78,7 +85,7 @@ Also, the result should be the same regardless of whether the code is at the beg
(concat padding-beginning unfilled padding-end)
pos
(lambda ()
- (let ((fill-column rust-test-fill-column))
+ (rust-test-with-standard-fill-settings
(fill-paragraph)))
(concat padding-beginning expected padding-end)))))
;; In addition to all the fill-paragraph tests, check that it works using fill-region
@@ -86,7 +93,7 @@ Also, the result should be the same regardless of whether the code is at the beg
unfilled
start-pos
(lambda ()
- (let ((fill-column rust-test-fill-column))
+ (rust-test-with-standard-fill-settings
(fill-region start-pos end-pos)))
expected)
))