1 ;; Authors: Martin Blais <blais@furius.ca>
2 ;; Date: $Date: 2005/04/01 23:19:41 $
3 ;; Copyright: This module has been placed in the public domain.
5 ;; Regression tests for rest-adjust-section-title.
8 (defvar rest-adjust-section-tests
21 (simple-cursor-in-line
32 (simple-cursor-beginning
43 (simple-at-end-of-buffer
51 (cursor-on-empty-line-under
86 (cursor-on-underline-one-char
114 (with-previous-text-rotating
140 "A list of regression tests for the section update method.")
143 (defun regression-test-compare-expect-buffer (testlist fun
)
144 "Run the regression tests for the section adjusting method."
146 (let ((buf (get-buffer-create "restructuredtext-regression-tests"))
149 (dolist (curtest testlist
)
150 ;; prepare a buffer with the starting text, and move the cursor where
151 ;; the special character is located
152 (switch-to-buffer buf
)
154 (insert (cadr curtest
))
155 (search-backward specchar
)
158 ;; run the section title update command n times
159 (dotimes (x (or (cadddr curtest
) 1))
162 ;; compare the buffer output with the expected text
167 (error "Test %s failed." (car curtest
))))
171 ;; evaluate this to run the tests, either interactively or in batch
172 (regression-test-compare-expect-buffer
173 rest-adjust-section-tests
175 (call-interactively 'rest-adjust-section-title
)))