Skip to content

Commit

Permalink
[#2357] Support both keywords and strings as test selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Jul 19, 2018
1 parent dbe38a7 commit 4b7aea3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* Rename `cider-refresh` to `cider-ns-refresh` (and all the related defcustoms).
* **(Breaking)** Rewrote connection management (see http://docs.cider.mx/en/latest/managing_connections/ for details).
* **(Breaking)** `cider-jack-in-clojurescript` now creates only a ClojureScript REPL (use `cider-jack-in-clj&cljs` to create both REPLs).
* [#2357](https://github.com/clojure-emacs/cider/issues/2357): Support both keywords and strings as test selectors (previously it was only strings).

## 0.17.0 (2018-05-07)

Expand Down
14 changes: 10 additions & 4 deletions cider-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,14 @@ This uses the Leiningen convention of appending '-test' to the namespace name."
(declare-function cider-emit-interactive-eval-output "cider-eval")
(declare-function cider-emit-interactive-eval-err-output "cider-eval")

(defun cider-test--prompt-for-selectors (message)
"Prompt for test selectors with MESSAGE.
The selectors can be either keywords or strings."
(mapcar
(lambda (string) (replace-regexp-in-string "^:+" "" string))
(split-string
(cider-read-from-minibuffer message))))

(defun cider-test-execute (ns &optional tests silent prompt-for-filters)
"Run tests for NS, which may be a keyword, optionally specifying TESTS.
This tests a single NS, or multiple namespaces when using keywords `:project',
Expand All @@ -636,12 +644,10 @@ The include/exclude selectors will be used to filter the tests before
(cider-test-clear-highlights)
(let ((include-selectors
(when prompt-for-filters
(split-string
(cider-read-from-minibuffer "Test selectors to include (space separated): "))))
(cider-test--prompt-for-selectors "Test selectors to include (space separated): ")))
(exclude-selectors
(when prompt-for-filters
(split-string
(cider-read-from-minibuffer "Test selectors to exclude (space separated): ")))))
(cider-test--prompt-for-selectors "Test selectors to exclude (space separated): "))))
(cider-map-repls :clj-strict
(lambda (conn)
(unless silent
Expand Down

0 comments on commit 4b7aea3

Please sign in to comment.