diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2016-03-28 00:39:26 -0300 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2016-03-30 12:58:44 -0300 |
commit | 6804a6a328fac884e7f259b829a79d5cf1610b9a (patch) | |
tree | 6fa87b2e67f4351495d81192e275d822900bd6f2 /cider-test.el | |
parent | 46f5d416e3f906eae7f99d6dd824ede7946ddcbe (diff) |
[Fix #1425] Define cider-auto-test-mode
Diffstat (limited to 'cider-test.el')
-rw-r--r-- | cider-test.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cider-test.el b/cider-test.el index fc689f3b..86904bf4 100644 --- a/cider-test.el +++ b/cider-test.el @@ -646,6 +646,29 @@ is searched." (cider-test-execute ns (cdr def)) (message "No test at point")))))) +;;; Auto-test mode +(defun cider--test-silently () + "Like `cider-test-run-tests', but with less feedback. +Only notify the user if there actually were any tests to run and only after +the results are received." + (when (cider-connected-p) + (let ((cider-auto-select-test-report-buffer nil) + (cider-test-show-report-on-success nil)) + (cider-test-run-ns-tests nil 'soft)))) + +;;;###autoload +(define-minor-mode cider-auto-test-mode + "Toggle automatic testing of Clojure files. + +When enabled this reruns tests every time a Clojure file is loaded. +Only runs tests corresponding to the loaded file's namespace and does +nothing if no tests are defined or if the file failed to load." + nil (cider-mode " Test") nil + :global t + (if cider-auto-test-mode + (add-hook 'cider-file-loaded-hook #'cider--test-silently) + (remove-hook 'cider-file-loaded-hook #'cider--test-silently))) + (provide 'cider-test) ;;; cider-test.el ends here |