Skip to content

Commit

Permalink
Cover all cases for padding in paragraph fills as intended
Browse files Browse the repository at this point in the history
  • Loading branch information
MicahChalmer committed Sep 7, 2013
1 parent be4f19a commit a469734
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/etc/emacs/rust-mode-tests.el
Expand Up @@ -51,20 +51,25 @@ Also, the result should be the same regardless of whether the code is at the beg
(padding-len (length padding)))
(loop
for pad-at-beginning from 0 to 1
for pad-at-end from 0 to 1
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
with padding-end = (if (= 0 pad-at-end) "" padding)
with padding-adjust = (* padding-len pad-at-beginning)
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
with padding-end = (if (= 0 pad-at-end) "" padding)
for pos from (if (= 1 start-pos) 1 (+ padding-adjust start-pos)) to (+ end-pos padding-adjust)
do (rust-test-manip-code
(concat padding-beginning unfilled padding-end)
pos
(lambda ()
(let ((fill-column rust-test-fill-column))
(fill-paragraph)))
(concat padding-beginning expected padding-end)))))
do (loop for pad-at-end from 0 to 1
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
with padding-end = (if (= 0 pad-at-end) "" padding)
with padding-adjust = (* padding-len pad-at-beginning)
with padding-beginning = (if (= 0 pad-at-beginning) "" padding)
with padding-end = (if (= 0 pad-at-end) "" padding)
;; If we're adding space to the beginning, and our start position
;; is at the very beginning, we want to test within the added space.
;; Otherwise adjust the start and end for the beginning padding.
with start-pos = (if (= 1 start-pos) 1 (+ padding-adjust start-pos))
with end-pos = (+ end-pos padding-adjust)
do (loop for pos from start-pos to end-pos
do (rust-test-manip-code
(concat padding-beginning unfilled padding-end)
pos
(lambda ()
(let ((fill-column rust-test-fill-column))
(fill-paragraph)))
(concat padding-beginning expected padding-end)))))))

(ert-deftest fill-paragraph-top-level-multi-line-style-doc-comment-second-line ()
(test-fill-paragraph
Expand Down

9 comments on commit a469734

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from nikomatsakis
at MicahChalmer@a469734

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging MicahChalmer/rust/emacs-fixes-round-2 = a469734 into auto

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MicahChalmer/rust/emacs-fixes-round-2 = a469734 merged ok, testing candidate = 25abb0ac

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from nikomatsakis
at MicahChalmer@a469734

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging MicahChalmer/rust/emacs-fixes-round-2 = a469734 into auto

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MicahChalmer/rust/emacs-fixes-round-2 = a469734 merged ok, testing candidate = b3d50fc

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 8, 2013

@bors
Copy link
Contributor

@bors bors commented on a469734 Sep 8, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = b3d50fc

Please sign in to comment.