[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit 0cd0011 109/224: Implement expected errors in test
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit 0cd0011 109/224: Implement expected errors in test suite. |
Date: |
Sat, 7 Aug 2021 09:22:30 -0400 (EDT) |
branch: elpa/paredit
commit 0cd0011c7602cc4ce7fe1c7076bfe7665112de9f
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Implement expected errors in test suite.
Ignore-this: c8b3e39457bf11ea71ae9a9a1f73b608
darcs-hash:20110409184426-00fcc-d13ce13ea3bf386527a93111959202f3cd0bbb33
---
test.el | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/test.el b/test.el
index ddb61c8..a7f504b 100644
--- a/test.el
+++ b/test.el
@@ -18,7 +18,7 @@
;;
;; You should have received a copy of the GNU General Public License
;; along with paredit. If not, see <http://www.gnu.org/licenses/>.
-
+
(defun paredit-test-failure-default (command before after expected)
(error "%S failed test: after %S, got %S but expected %S."
command before after expected))
@@ -35,7 +35,7 @@ Four arguments: the paredit command, the text of the buffer
(defun paredit-test (command examples)
(dolist (example examples)
(let ((before (car example)))
- (dolist (after (cdr example))
+ (dolist (expected (cdr example))
(with-temp-buffer
(scheme-mode)
(set (make-local-variable 'indent-tabs-mode) nil)
@@ -44,11 +44,18 @@ Four arguments: the paredit command, the text of the buffer
(goto-char (point-min))
(search-forward "|")
(backward-delete-char +1)
- (funcall command)
- (insert ?\|)
- (if (not (string= after (buffer-string)))
- (paredit-test-failed command before (buffer-string) after)))
- (setq before after)))))
+ (if (cond ((eq expected 'error)
+ ;++ Check that there are no more expected states.
+ (condition-case condition
+ (progn (funcall command) t)
+ (error nil)))
+ ((stringp expected)
+ (funcall command)
+ (insert ?\|)
+ (not (string= expected (buffer-string))))
+ (t (error "Bad test expectation:" expected)))
+ (paredit-test-failed command before (buffer-string) expected)))
+ (setq before expected)))))
(paredit-do-commands (spec keys command examples)
nil ;string case
@@ -65,8 +72,10 @@ Four arguments: the paredit command, the text of the buffer
(mapcar
(lambda (example)
(mapcar (lambda (step)
- (replace-regexp-in-string "(" (string left)
- (replace-regexp-in-string ")" (string right) step)))
+ (if (stringp step)
+ (replace-regexp-in-string "(" (string left)
+ (replace-regexp-in-string ")" (string right) step))
+ step))
example))
examples)))))
- [nongnu] elpa/paredit 41bbc20 078/224: Make `paredit-comment-dwim' code comment example work in isolation., (continued)
- [nongnu] elpa/paredit 41bbc20 078/224: Make `paredit-comment-dwim' code comment example work in isolation., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5e210b2 087/224: Fix bug in recent change to more carefully delete comment ends., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d9ecc6d 094/224: Handle scan errors in `paredit-scan-sexps-hack'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 6c14694 113/224: Use `call-interactively' rather than `funcall' in `paredit-test'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 9cac6fa 106/224: Specify that paredit should work in XEmacs 21.5.28 or later., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0bb4b62 110/224: Check for expected errors in `paredit-close-FOO'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 3c48233 122/224: Fix checks on deletion of comment boundaries., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 620c3a2 116/224: Break page in test.el before indentation regression tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d681e3c 111/224: Check for expected errors in `paredit-forward-delete'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5dc93f9 114/224: Omit redundant `paredit-forward-delete' test., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0cd0011 109/224: Implement expected errors in test suite.,
ELPA Syncer <=
- [nongnu] elpa/paredit 8ee8f13 118/224: Fix `paredit-insert-pair' when buffer ends with no-newline comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit fc78011 121/224: Tweak `paredit-check-region' and `paredit-region-ok-p'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 621be23 124/224: Add some tests for recent changes to deletion and killing commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit fac925d 125/224: Tweak safe region deletion., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8d87576 129/224: Fix logic in checking region deletion across comment boundaries., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 4723fb3 132/224: Add and fix some tests for `(' and `)' while in a character literal., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5558fd0 137/224: Make `paredit-in-char-p' work recursively., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 88a5cf7 139/224: Be explicit about Transient Mark Mode in `paredit-wrap-*' tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d80a9db 141/224: Fail early in `paredit-convolute-sexp'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2ec6000 145/224: Fix error message in `paredit-test'., ELPA Syncer, 2021/08/07