@@ -51,20 +51,25 @@ Also, the result should be the same regardless of whether the code is at the beg
51
51
(padding-len (length padding)))
52
52
(loop
53
53
for pad-at-beginning from 0 to 1
54
- for pad-at-end from 0 to 1
55
- with padding-beginning = (if (= 0 pad-at-beginning) " " padding)
56
- with padding-end = (if (= 0 pad-at-end) " " padding)
57
- with padding-adjust = (* padding-len pad-at-beginning)
58
- with padding-beginning = (if (= 0 pad-at-beginning) " " padding)
59
- with padding-end = (if (= 0 pad-at-end) " " padding)
60
- for pos from (if (= 1 start-pos) 1 (+ padding-adjust start-pos)) to (+ end-pos padding-adjust)
61
- do (rust-test-manip-code
62
- (concat padding-beginning unfilled padding-end)
63
- pos
64
- (lambda ()
65
- (let ((fill-column rust-test-fill-column))
66
- (fill-paragraph )))
67
- (concat padding-beginning expected padding-end)))))
54
+ do (loop for pad-at-end from 0 to 1
55
+ with padding-beginning = (if (= 0 pad-at-beginning) " " padding)
56
+ with padding-end = (if (= 0 pad-at-end) " " padding)
57
+ with padding-adjust = (* padding-len pad-at-beginning)
58
+ with padding-beginning = (if (= 0 pad-at-beginning) " " padding)
59
+ with padding-end = (if (= 0 pad-at-end) " " padding)
60
+ ; ; If we're adding space to the beginning, and our start position
61
+ ; ; is at the very beginning, we want to test within the added space.
62
+ ; ; Otherwise adjust the start and end for the beginning padding.
63
+ with start-pos = (if (= 1 start-pos) 1 (+ padding-adjust start-pos))
64
+ with end-pos = (+ end-pos padding-adjust)
65
+ do (loop for pos from start-pos to end-pos
66
+ do (rust-test-manip-code
67
+ (concat padding-beginning unfilled padding-end)
68
+ pos
69
+ (lambda ()
70
+ (let ((fill-column rust-test-fill-column))
71
+ (fill-paragraph )))
72
+ (concat padding-beginning expected padding-end)))))))
68
73
69
74
(ert-deftest fill-paragraph-top-level-multi-line-style-doc-comment-second-line ()
70
75
(test-fill-paragraph
0 commit comments