diff options
author | blais <blais@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-04-02 23:43:57 +0000 |
---|---|---|
committer | blais <blais@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-04-02 23:43:57 +0000 |
commit | e27b1c2a3a25166e5d9da85a7bb9df3821f888da (patch) | |
tree | cecb408be723eb534848d84b404b5ad7a0ada2a6 | |
parent | 09a79cba321bfea1c70b96cdfb026cdfcfbc9def (diff) | |
download | docutils-reporter-categories@3161.tar.gz |
A simple first stab at a series of regressionreporter-categories@3161
tests for the section underlining function.
I still have to write many of the other tests.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3161 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | tools/editors/emacs/restructuredtext.el | 5 | ||||
-rw-r--r-- | tools/editors/emacs/tests/tests-adjust-section.el | 181 |
2 files changed, 184 insertions, 2 deletions
diff --git a/tools/editors/emacs/restructuredtext.el b/tools/editors/emacs/restructuredtext.el index 113b99cfe..c7c431f05 100644 --- a/tools/editors/emacs/restructuredtext.el +++ b/tools/editors/emacs/restructuredtext.el @@ -1,5 +1,5 @@ -;; Authors: David Goodger <goodger@python.org>; -;; Martin Blais +;; Authors: David Goodger <goodger@python.org>, +;; Martin Blais <blais@furius.ca> ;; Date: $Date$ ;; Copyright: This module has been placed in the public domain. ;; @@ -447,6 +447,7 @@ This is useful for filling list item paragraphs." ))) ))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Generic character repeater function. diff --git a/tools/editors/emacs/tests/tests-adjust-section.el b/tools/editors/emacs/tests/tests-adjust-section.el new file mode 100644 index 000000000..df01b2bd5 --- /dev/null +++ b/tools/editors/emacs/tests/tests-adjust-section.el @@ -0,0 +1,181 @@ +;; Authors: Martin Blais <blais@furius.ca> +;; Date: $Date: 2005/04/01 23:19:41 $ +;; Copyright: This module has been placed in the public domain. +;; +;; Regression tests for rest-adjust-section-title. +;; + +(defvar rest-adjust-section-tests + '( + (simple +" +Some Title@ + +" +" +Some Title +========== + +") + + (simple-cursor-in-line +" +Some Tit@le + +" +" +Some Title +========== + +") + + (simple-cursor-beginning +" +@Some Title + +" +" +Some Title +========== + +") + + (simple-at-end-of-buffer +" +Some Title@" +" +Some Title +========== +") + + (cursor-on-empty-line-under +" +Some Title +@ +" +" +Some Title +========== + +") + + + + (partial +" +Some Title@ +--- +" +" +Some Title +---------- + +") + + (cursor-on-underline +" +Some Title +---@ +" +" +Some Title +---------- + +") + + (cursor-on-underline-one-char +" +Some Title +~@ +" +" +Some Title +~~~~~~~~~~ + +") + + (with-previous-text +" +Some Title +********** + +Subtitle@ + +" +" +Some Title +********** + +Subtitle +******** + +") + + (with-previous-text-rotating +" +Some Title +========== + +Subtitle +-------- + +Subtitle2@ + +" +" +Some Title +========== + +Subtitle +-------- + +Subtitle2 +========= + +" +2) + + ) + + "A list of regression tests for the section update method.") + + +(defun regression-test-compare-expect-buffer (testlist fun) + "Run the regression tests for the section adjusting method." + + (let ((buf (get-buffer-create "restructuredtext-regression-tests")) + (specchar "@") + ) + (dolist (curtest testlist) + ;; prepare a buffer with the starting text, and move the cursor where + ;; the special character is located + (switch-to-buffer buf) + (erase-buffer) + (insert (cadr curtest)) + (search-backward specchar) + (delete-char 1) + + ;; run the section title update command n times + (dotimes (x (or (cadddr curtest) 1)) + (funcall fun)) + + ;; compare the buffer output with the expected text + (or (string= + (buffer-string) + (caddr curtest)) + (progn + (error "Test %s failed." (car curtest)))) + ) + )) + +;; evaluate this to run the tests, either interactively or in batch +(regression-test-compare-expect-buffer + rest-adjust-section-tests + (lambda () + (call-interactively 'rest-adjust-section-title))) + + + + + + |