Skip to content

Commit

Permalink
elisp test buffer: run only current buffer's tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bmag authored and syl20bnr committed Oct 10, 2016
1 parent 3716b9e commit bbe29b9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion layers/+distributions/spacemacs-base/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,18 @@ The body of the advice is in BODY."
(if (y-or-n-p (format "Erase content of buffer %s ? " (current-buffer)))
(erase-buffer)))

(defun spacemacs//find-ert-test-buffer (ert-test)
"Return the buffer where ERT-TEST is defined."
(car (find-definition-noselect (ert-test-name ert-test) 'ert-deftest)))

(defun spacemacs/ert-run-tests-buffer ()
"Run all the tests in the current buffer."
(interactive)
(save-buffer)
(load-file (buffer-file-name))
(ert t))
(let ((cbuf (current-buffer)))
(ert '(satisfies (lambda (test)
(eq cbuf (spacemacs//find-ert-test-buffer test)))))))

(defun spacemacs/alternate-buffer (&optional window)
"Switch back and forth between current and last buffer in the
Expand Down

0 comments on commit bbe29b9

Please sign in to comment.