Add emacs-ert-mode + ert test defuns
This commit is contained in:
parent
0900c9b7fb
commit
272993c4b3
4 changed files with 56 additions and 1 deletions
|
@ -12,5 +12,37 @@
|
|||
(let ((func (function-called-at-point)))
|
||||
(if func (find-function-other-window func))))
|
||||
|
||||
(defun narf--ert-pre ()
|
||||
(save-buffer)
|
||||
(eval-buffer))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-run-test ()
|
||||
(interactive)
|
||||
(let (case-fold-search)
|
||||
(narf--ert-pre)
|
||||
(aif (thing-at-point 'defun t)
|
||||
(if (string-match "(ert-deftest \\([^ ]+\\)" it)
|
||||
(ert-run-tests-interactively (substring it (match-beginning 1) (match-end 1)))
|
||||
(user-error "Invalid test at point"))
|
||||
(user-error "No test found at point"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-rerun-test ()
|
||||
(interactive)
|
||||
(let (case-fold-search)
|
||||
(narf--ert-pre)
|
||||
(aif (car-safe ert--selector-history)
|
||||
(ert-run-tests-interactively it)
|
||||
(message "No test found in history, looking for test at point")
|
||||
(narf/ert-run-test))))
|
||||
|
||||
;;;###autoload
|
||||
(defun narf/ert-run-all-tests ()
|
||||
(interactive)
|
||||
(ert-delete-all-tests)
|
||||
(narf--ert-pre)
|
||||
(ert-run-tests-interactively t))
|
||||
|
||||
(provide 'defuns-lisp)
|
||||
;;; defuns-lisp.el ends here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue