From a33eb59d5f2cd7352f86793c8ec5f6402f83b7b4 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Mon, 21 Mar 2016 20:55:25 +0200 Subject: [Fix #1625] Display a more meaningful message when running individual tests --- CHANGELOG.md | 2 ++ cider-test.el | 30 +++++++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e1ded4f..7a05eb22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * [#1599](https://github.com/clojure-emacs/cider/pull/1599): Don't error when test makes 0 assertions. * [#1563](https://github.com/clojure-emacs/cider/issues/1563): Handle invalid regular expressions in apropos. +* [#1625](https://github.com/clojure-emacs/cider/issues/1625): Display a more meaningful message when running +an individual test using `C-c C-t t`. ### New Features diff --git a/cider-test.el b/cider-test.el index 0f28e793..7fa018ab 100644 --- a/cider-test.el +++ b/cider-test.el @@ -402,16 +402,21 @@ With the actual value, the outermost '(not ...)' s-expression is removed." ;;; Message echo -(defun cider-test-echo-running (ns) - "Echo a running message for the test NS, which may be a keyword." - (message "Running tests in %s..." - (concat (cider-propertize - (cond ((stringp ns) ns) - ((eq :non-passing ns) "failing") - ((eq :loaded ns) "all loaded") - ((eq :project ns) "all project")) - 'ns) - (unless (stringp ns) " namespaces")))) +(defun cider-test-echo-running (ns &optional test) + "Echo a running message for the test NS, which may be a keyword. +The optional arg TEST denotes an individual test name." + (if test + (message "Running test %s in %s..." + (cider-propertize test 'bold) + (cider-propertize ns 'ns)) + (message "Running tests in %s..." + (concat (cider-propertize + (cond ((stringp ns) ns) + ((eq :non-passing ns) "failing") + ((eq :loaded ns) "all loaded") + ((eq :project ns) "all project")) + 'ns) + (unless (stringp ns) " namespaces"))))) (defun cider-test-echo-summary (summary results) "Echo SUMMARY statistics for a test run returning RESULTS." @@ -539,7 +544,10 @@ are highlighted." (cider-test-clear-highlights) (cider-map-connections (lambda (conn) - (cider-test-echo-running ns) + (if (and tests (= (length tests) 1)) + ;; we generate a different message when running individual tests + (cider-test-echo-running ns (car tests)) + (cider-test-echo-running ns)) (cider-nrepl-send-request (list "op" (cond ((stringp ns) "test") ((eq :project ns) "test-all") -- cgit v1.2.3