1 ;; Tests for functions around filling
3 (add-to-list 'load-path
".")
7 (ert-deftest fill-asserts
()
8 "Check some assertions."
9 (should (equal ert-Buf-point-char
"\^@"))
10 (should (equal ert-Buf-mark-char
"\^?"))
14 "Wrapper to do auto fill."
15 (let ((fc fill-column
))
19 (funcall auto-fill-function
)))
21 (ert-deftest auto-fill
()
22 "Tests for auto fill."
23 (let ((rst-indent-width 2)
25 (rst-indent-literal-normal 3)
26 (rst-indent-literal-minimized 2)
27 (rst-indent-comment 3)
29 (should (ert-equal-buffer
32 * This is a test with a fill column of 20\^@"
38 (should (ert-equal-buffer
42 with a fill column of 20\^@"
48 (should (ert-equal-buffer
51 :Field: Does this work for fields?\^@"
57 (should (ert-equal-buffer
67 (should (ert-equal-buffer
70 .. dir:: Yes, quite fine\^@"
75 (should (ert-equal-buffer
78 .. dir:: Yes, quite fine\^@
85 (should (ert-equal-buffer
88 .. |s| r:: Dir ectives had problems\^@"
95 (should (ert-equal-buffer
107 (should (ert-equal-buffer
110 .. [CIT] X cit is citations are also filled\^@"
117 (should (ert-equal-buffer
129 (should (ert-equal-buffer
132 .. Comments should also fill nicely\^@"
137 (should (ert-equal-buffer
140 Normal text should also fill as expected\^@"
146 (should (ert-equal-buffer
149 Normal text should also fill as expected\^@"
155 (should (ert-equal-buffer
158 Normal text should also fill \^@as expected"
161 also fill \^@as expected"
165 (defun explicit-fill ()
166 "Wrapper for `fill-paragraph'."
167 (let ((fc fill-column
))
169 (setq fill-column fc
)
171 (untabify (point-min) (point-max))))
173 (ert-deftest fill-paragraph
()
174 "Tests for `fill-paragraph'."
175 (let ((rst-indent-width 2)
177 (rst-indent-literal-normal 3)
178 (rst-indent-literal-minimized 2)
179 (rst-indent-comment 3)
181 (should (ert-equal-buffer
184 * This is a test with a fill column of 20\^@
192 (should (ert-equal-buffer
195 * This is a test \^@with a fill column
200 \^@with a fill column
204 (should (ert-equal-buffer
207 :Field: Does this work for fields?\^@
215 (should (ert-equal-buffer
218 :Field: Does this work\^@ for
227 (should (ert-equal-buffer
230 .. dir:: Yes, quite fine\^@
237 (should (ert-equal-buffer
240 \^@.. dir:: Yes, quite
244 \^@.. dir:: Yes, quite
248 (should (ert-equal-buffer
251 .. dir:: Yes, quite fine\^@
260 (should (ert-equal-buffer
263 .. [CIT] X cit is citations are also filled\^@
272 (should (ert-equal-buffer
276 citations are also filled\^@
284 (should (ert-equal-buffer
288 citations are also filled\^@
296 (should (ert-equal-buffer
299 .. |s| r:: Dir ectives had problems\^@
308 (should (ert-equal-buffer
311 \^@.. |s| r:: Dir ectives had problems
320 (should (ert-equal-buffer
324 ectives had problems\^@
332 (should (ert-equal-buffer
335 Normal \^@text should also fill as expected
338 Normal \^@text should
343 (should (ert-equal-buffer
346 \^@Normal text should also fill as expected
349 \^@Normal text should
354 (should (ert-equal-buffer
357 Normal text should also fill as expected\^@
365 (should (ert-equal-buffer
368 Normal text should also fill as expected
370 Normal text should also fill as expected\^@
373 Normal text should also fill as expected
380 (should (ert-equal-buffer
383 \^@Normal text should
388 \^@Normal text should
395 (ert-deftest fill-paragraph-fixme
()
396 "Tests for `fill-paragraph'."
397 :expected-result
:failed
398 (let ((rst-indent-width 2)
400 (rst-indent-literal-normal 3)
401 (rst-indent-literal-minimized 2)
402 (rst-indent-comment 3)
404 (should (ert-equal-buffer
407 \^@Normal text should
412 \^@Normal text should
419 (defun explicit-fill-region ()
420 "Wrapper for `fill-region'."
421 (let ((fc fill-column
))
423 (setq fill-column fc
)
424 (call-interactively 'fill-region
)
425 (untabify (point-min) (point-max))))
427 (ert-deftest fill-region
()
428 "Tests for `fill-region'."
429 (let ((rst-indent-width 2)
431 (rst-indent-literal-normal 3)
432 (rst-indent-literal-minimized 2)
433 (rst-indent-comment 3)
435 (should (ert-equal-buffer
436 (explicit-fill-region)
438 * This is a test with a fill column of 20
440 * This is a test with a fill column
443 :Field: Does this work for fields?
445 :Field: Does this work for
448 .. dir:: Yes, quite fine
453 .. dir:: Yes, quite fine
454 :f: Field for a directive
456 .. [CIT] X cit is citations are also filled
458 .. |s| r:: Dir ectives had problems
460 .. |s| r:: Dir ectives had problems
462 Normal text should also fill as expected
464 Normal text should also fill as expected
518 (should (ert-equal-buffer
519 (explicit-fill-region)
521 * This is a test with a fill column of 20
522 * This is a test with a fill column
524 :Field: Does this work for fields?
525 :Field: Does this work for
527 .. dir:: Yes, quite fine
530 .. dir:: Yes, quite fine
531 :f: Field for a directive
532 .. [CIT] X cit is citations are also filled
533 .. |s| r:: Dir ectives had problems
534 .. |s| r:: Dir ectives had problems
536 Normal text should also fill as expected
538 Normal text should also fill as expected