summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell+paredit@mumble.net>2020-11-30 16:30:29 +0000
committerTaylor R Campbell <campbell+paredit@mumble.net>2020-11-30 16:30:29 +0000
commit86f1f5f3dd3358e1bb557a02465017e48b9e23a1 (patch)
tree038feb138e7da311cec79996b441766c95d50ba5
parent84e8ccd2ae3e2d9033533cdd4ce69fb254b20067 (diff)
Stop each test on first failure or unexpected success.
-rw-r--r--test.el56
1 files changed, 30 insertions, 26 deletions
diff --git a/test.el b/test.el
index 539f8b2..07389a6 100644
--- a/test.el
+++ b/test.el
@@ -43,33 +43,37 @@ Four arguments: the paredit command, the text of the buffer
(and (eq (car example) 'xfail)
(progn (setq example (cdr example)) t)))
(before (car example)))
- (dolist (expected (cdr example))
- (with-temp-buffer
- (paredit-test-buffer-setup)
- (insert before)
- (goto-char (point-min))
- (if (search-forward "_" nil t)
- (progn (delete-char -1) (set-mark (point))))
- (goto-char (point-min))
- (search-forward "|")
- (delete-char -1)
- (if (cond ((eq expected 'error)
- ;++ Check that there are no more expected states.
- (condition-case condition
- (progn (call-interactively command) t)
- (error nil)))
- ((stringp expected)
- (call-interactively command)
- (insert ?\|)
- (not (string= expected (buffer-string))))
- (t (error "Bad test expectation: %S" expected)))
- (if (not xfail)
+ (catch 'break
+ (dolist (expected (cdr example))
+ (with-temp-buffer
+ (paredit-test-buffer-setup)
+ (insert before)
+ (goto-char (point-min))
+ (if (search-forward "_" nil t)
+ (progn (delete-char -1) (set-mark (point))))
+ (goto-char (point-min))
+ (search-forward "|")
+ (delete-char -1)
+ (if (cond ((eq expected 'error)
+ ;++ Check that there are no more expected states.
+ (condition-case condition
+ (progn (call-interactively command) t)
+ (error nil)))
+ ((stringp expected)
+ (call-interactively command)
+ (insert ?\|)
+ (not (string= expected (buffer-string))))
+ (t (error "Bad test expectation: %S" expected)))
+ (progn
+ (if (not xfail)
+ (let ((actual (buffer-string)))
+ (paredit-test-failed command before actual expected)))
+ (throw 'break nil))
+ (if xfail
(let ((actual (buffer-string)))
- (paredit-test-failed command before actual expected)))
- (if xfail
- (let ((actual (buffer-string)))
- (paredit-test-failed command before actual 'failure)))))
- (setq before expected)))))
+ (paredit-test-failed command before actual 'failure)
+ (throw 'break nil)))))
+ (setq before expected))))))
(defun paredit-test-buffer-setup ()
(scheme-mode)