[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
better ERT: a function to auto-run the last re-run test
From: |
Nic Ferrier |
Subject: |
better ERT: a function to auto-run the last re-run test |
Date: |
Fri, 29 Mar 2013 23:11:07 +0000 |
While I am using ERT I often get in a situation where I want to rerun
the last test over and over and over. I don't need to see the *ert*
buffer, the minibuffer is enough feedback.
I couldn't easily script this without changing ERT.
So here's attached is my diff to allow this to happen.
I think I have signed papers (I can't remember, it was a long time ago)
but this also seems like a small change.
Is it wanted?
Nic Ferrier
diff -u /home/nferrier/emacs/lisp/emacs-lisp/ert.el
/home/nferrier/emacs-local-24/share/emacs/24.2/lisp/emacs-lisp/ert.el
--- /home/nferrier/emacs/lisp/emacs-lisp/ert.el 2012-09-02 23:42:29.488461456
+0100
+++ /home/nferrier/emacs-local-24/share/emacs/24.2/lisp/emacs-lisp/ert.el
2013-03-29 23:04:40.590960042 +0000
@@ -469,6 +469,7 @@
"Evaluate FORM. If it returns nil, abort the current test as failed.
Returns the value of FORM."
+ (declare (debug (&rest form)))
(ert--expand-should `(should ,form) form
(lambda (inner-form form-description-form value-var)
`(unless ,inner-form
@@ -2298,6 +2299,21 @@
(let ((selector (ert--stats-selector ert--results-stats)))
(ert-run-tests-interactively selector (buffer-name))))
+(defvar ert-last-rerun-test nil
+ "The last rerun test")
+
+(defun ert-rerun-last-rerun ()
+ (interactive)
+ (with-current-buffer (get-buffer "*ert*")
+ (let ((point (point)))
+ (goto-char
+ (text-property-any
+ (point-min) (point-max)
+ 'ert-test-name ert-last-rerun-test))
+ (ert-results-rerun-test-at-point)
+ (goto-char point))))
+
+
(defun ert-results-rerun-test-at-point ()
"Re-run the test at point.
@@ -2324,7 +2340,8 @@
(progn
(message "%s..." progress-message)
(ert-run-or-rerun-test stats test
- ert--results-listener))
+ ert--results-listener)
+ (setq ert-last-rerun-test (ert-test-name test)))
(ert--results-update-stats-display ert--results-ewoc stats)
(message "%s...%s"
progress-message
Diff finished. Fri Mar 29 23:06:28 2013
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- better ERT: a function to auto-run the last re-run test,
Nic Ferrier <=