Skip to content

Commit 22fff6a

Browse files
authored
Merge pull request #488 from jimblandy/fill-variables
Establish more-controlled environment for fill-paragraph tests.
2 parents c12348e + 673a322 commit 22fff6a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

rust-mode-tests.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
5454
(should (rust-compare-code-after-manip
5555
original point-pos manip-func expected (buffer-string)))))
5656

57+
(defmacro rust-test-with-standard-fill-settings (&rest body)
58+
(declare (indent defun))
59+
`(let ((fill-column rust-test-fill-column)
60+
(sentence-end-double-space t)
61+
(colon-double-space nil))
62+
,@body))
63+
5764
(defun rust-test-fill-paragraph (unfilled expected &optional start-pos end-pos)
5865
"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.
5966
@@ -78,15 +85,15 @@ Also, the result should be the same regardless of whether the code is at the beg
7885
(concat padding-beginning unfilled padding-end)
7986
pos
8087
(lambda ()
81-
(let ((fill-column rust-test-fill-column))
88+
(rust-test-with-standard-fill-settings
8289
(fill-paragraph)))
8390
(concat padding-beginning expected padding-end)))))
8491
;; In addition to all the fill-paragraph tests, check that it works using fill-region
8592
(rust-test-manip-code
8693
unfilled
8794
start-pos
8895
(lambda ()
89-
(let ((fill-column rust-test-fill-column))
96+
(rust-test-with-standard-fill-settings
9097
(fill-region start-pos end-pos)))
9198
expected)
9299
))

0 commit comments

Comments
 (0)