@@ -141,7 +141,7 @@ Add to this list to have CIDER recognize additional test defining macros."
141
141
(define-key map (kbd " C-t" ) #'cider-test-run-test )
142
142
(define-key map (kbd " C-g" ) #'cider-test-rerun-test )
143
143
(define-key map (kbd " C-n" ) #'cider-test-run-ns-tests )
144
- (define-key map (kbd " C-s" ) #'cider-test-run-ns-tests-with-selector )
144
+ (define-key map (kbd " C-s" ) #'cider-test-run-ns-tests-with-filters )
145
145
(define-key map (kbd " C-l" ) #'cider-test-run-loaded-tests )
146
146
(define-key map (kbd " C-p" ) #'cider-test-run-project-tests )
147
147
(define-key map (kbd " C-b" ) #'cider-test-show-report )
@@ -150,7 +150,7 @@ Add to this list to have CIDER recognize additional test defining macros."
150
150
(define-key map (kbd " t" ) #'cider-test-run-test )
151
151
(define-key map (kbd " g" ) #'cider-test-rerun-test )
152
152
(define-key map (kbd " n" ) #'cider-test-run-ns-tests )
153
- (define-key map (kbd " s" ) #'cider-test-run-ns-tests-with-selector )
153
+ (define-key map (kbd " s" ) #'cider-test-run-ns-tests-with-filters )
154
154
(define-key map (kbd " l" ) #'cider-test-run-loaded-tests )
155
155
(define-key map (kbd " p" ) #'cider-test-run-project-tests )
156
156
(define-key map (kbd " b" ) #'cider-test-show-report )
@@ -160,11 +160,11 @@ Add to this list to have CIDER recognize additional test defining macros."
160
160
'(" Test"
161
161
[" Run test" cider-test-run-test]
162
162
[" Run namespace tests" cider-test-run-ns-tests]
163
- [" Run namespace tests with selector " cider-test-run-ns-tests-with-selector ]
163
+ [" Run namespace tests with filters " cider-test-run-ns-tests-with-filters ]
164
164
[" Run all loaded tests" cider-test-run-loaded-tests]
165
- [" Run all loaded tests with selector " (apply-partially cider-test-run-loaded-tests 'prompt-for-selector )]
165
+ [" Run all loaded tests with filters " (apply-partially cider-test-run-loaded-tests 'prompt-for-filters )]
166
166
[" Run all project tests" cider-test-run-project-tests]
167
- [" Run all project tests with selector " (apply-partially cider-test-run-project-tests 'prompt-for-selector )]
167
+ [" Run all project tests with filters " (apply-partially cider-test-run-project-tests 'prompt-for-filters )]
168
168
[" Run tests after load-file" cider-auto-test-mode
169
169
:style toggle :selected cider-auto-test-mode]
170
170
" --"
@@ -191,7 +191,7 @@ Add to this list to have CIDER recognize additional test defining macros."
191
191
; ; `f' for "run failed".
192
192
(define-key map " f" #'cider-test-rerun-failed-tests )
193
193
(define-key map " n" #'cider-test-run-ns-tests )
194
- (define-key map " s" #'cider-test-run-ns-tests-with-selector )
194
+ (define-key map " s" #'cider-test-run-ns-tests-with-filters )
195
195
(define-key map " l" #'cider-test-run-loaded-tests )
196
196
(define-key map " p" #'cider-test-run-project-tests )
197
197
; ; `g' generally reloads the buffer. The closest thing we have to that is
@@ -208,11 +208,11 @@ Add to this list to have CIDER recognize additional test defining macros."
208
208
[" Rerun current test" cider-test-run-test]
209
209
[" Rerun failed/erring tests" cider-test-rerun-failed-tests]
210
210
[" Run all ns tests" cider-test-run-ns-tests]
211
- [" Run all ns tests with selector " cider-test-run-ns-tests-with-selector ]
211
+ [" Run all ns tests with filters " cider-test-run-ns-tests-with-filters ]
212
212
[" Run all loaded tests" cider-test-run-loaded-tests]
213
- [" Run all loaded tests with selector " (apply-partially cider-test-run-loaded-tests 'prompt-for-selector )]
213
+ [" Run all loaded tests with filters " (apply-partially cider-test-run-loaded-tests 'prompt-for-filters )]
214
214
[" Run all project tests" cider-test-run-project-tests]
215
- [" Run all project tests with selector " (apply-partially cider-test-run-project-tests 'prompt-for-selector )]
215
+ [" Run all project tests with filters " (apply-partially cider-test-run-project-tests 'prompt-for-filters )]
216
216
" --"
217
217
[" Jump to test definition" cider-test-jump]
218
218
[" Display test error" cider-test-stacktrace]
@@ -620,7 +620,7 @@ This uses the Leiningen convention of appending '-test' to the namespace name."
620
620
(declare-function cider-emit-interactive-eval-output " cider-interaction" )
621
621
(declare-function cider-emit-interactive-eval-err-output " cider-interaction" )
622
622
623
- (defun cider-test-execute (ns &optional tests silent prompt-for-selector )
623
+ (defun cider-test-execute (ns &optional tests silent prompt-for-filters )
624
624
" Run tests for NS, which may be a keyword, optionally specifying TESTS.
625
625
626
626
This tests a single NS, or multiple namespaces when using keywords `:project' ,
@@ -629,10 +629,18 @@ namespace is specified. Upon test completion, results are echoed and a test
629
629
report is optionally displayed. When test failures/errors occur, their sources
630
630
are highlighted.
631
631
If SILENT is non-nil, suppress all messages other then test results.
632
- If PROMPT-FOR-SELECTOR is non-nil, prompt the user for a test selector.
633
- The selector will be used to filter the tests before running them."
632
+ If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selector filters.
633
+ The include/exclude selectors will be used to filter the tests before
634
+ running them."
634
635
(cider-test-clear-highlights)
635
- (let ((selector (when prompt-for-selector (cider-read-from-minibuffer " Test selector (as string): " ))))
636
+ (let ((include-selectors
637
+ (when prompt-for-filters
638
+ (split-string
639
+ (cider-read-from-minibuffer " Test selectors to include (space separated): " ))))
640
+ (exclude-selectors
641
+ (when prompt-for-filters
642
+ (split-string
643
+ (cider-read-from-minibuffer " Test selectors to exclude (space separated): " )))))
636
644
(cider-map-connections
637
645
(lambda (conn )
638
646
(unless silent
@@ -641,16 +649,15 @@ The selector will be used to filter the tests before running them."
641
649
(cider-test-echo-running ns (car tests))
642
650
(cider-test-echo-running ns)))
643
651
(cider-nrepl-send-request
644
- `(" op" ,(cond ((stringp ns) " test" )
645
- ((eq :project ns) " test-all" )
646
- ((eq :loaded ns) " test-all" )
647
- ((eq :non-passing ns) " retest" ))
648
- " selector" ,(when (stringp selector) selector)
649
- " ns" ,(when (stringp ns) ns)
650
- " tests" ,(when (stringp ns) tests)
651
- " load?" ,(when (or (stringp ns)
652
- (eq :project ns))
653
- " true" ))
652
+ `(" op" ,(cond ((stringp ns) " test" )
653
+ ((eq :project ns) " test-all" )
654
+ ((eq :loaded ns) " test-all" )
655
+ ((eq :non-passing ns) " retest" ))
656
+ " includes" ,(when (listp include-selectors) include-selectors)
657
+ " excludes" ,(when (listp exclude-selectors) exclude-selectors)
658
+ " ns" ,(when (stringp ns) ns)
659
+ " tests" ,(when (stringp ns) tests)
660
+ " load?" ,(when (or (stringp ns) (eq :project ns)) " true" ))
654
661
(lambda (response )
655
662
(nrepl-dbind-response response (summary results status out err)
656
663
(cond ((member " namespace-not-found" status)
@@ -692,40 +699,40 @@ The selector will be used to filter the tests before running them."
692
699
(message " No prior failures to retest " )))
693
700
(message " No prior results to retest " )))
694
701
695
- (defun cider-test-run-loaded-tests (prompt-for-selector )
702
+ (defun cider-test-run-loaded-tests (prompt-for-filters )
696
703
" Run all tests defined in currently loaded namespaces.
697
704
698
- If PROMPT-FOR-SELECTOR is non-nil, prompt the user for a test selector to filter the tests with."
705
+ If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to filter the tests with."
699
706
(interactive " P" )
700
- (cider-test-execute :loaded nil nil prompt-for-selector ))
707
+ (cider-test-execute :loaded nil nil prompt-for-filters ))
701
708
702
- (defun cider-test-run-project-tests (prompt-for-selector )
709
+ (defun cider-test-run-project-tests (prompt-for-filters )
703
710
" Run all tests defined in all project namespaces, loading these as needed.
704
711
705
- If PROMPT-FOR-SELECTOR is non-nil, prompt the user for a test selector to filter the tests with."
712
+ If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to filter the tests with."
706
713
(interactive " P" )
707
- (cider-test-execute :project nil nil prompt-for-selector ))
714
+ (cider-test-execute :project nil nil prompt-for-filters ))
708
715
709
- (defun cider-test-run-ns-tests-with-selector (suppress-inference )
710
- " Run tests filtered by a selector for the current Clojure namespace context.
716
+ (defun cider-test-run-ns-tests-with-filters (suppress-inference )
717
+ " Run tests filtered by selectors for the current Clojure namespace context.
711
718
712
719
With a prefix arg SUPPRESS-INFERENCE it will try to run the tests in the
713
720
current ns."
714
721
(interactive " P" )
715
722
(cider-test-run-ns-tests suppress-inference nil 't ))
716
723
717
- (defun cider-test-run-ns-tests (suppress-inference &optional silent prompt-for-selector )
724
+ (defun cider-test-run-ns-tests (suppress-inference &optional silent prompt-for-filters )
718
725
" Run all tests for the current Clojure namespace context.
719
726
720
727
If SILENT is non-nil, suppress all messages other then test results.
721
728
With a prefix arg SUPPRESS-INFERENCE it will try to run the tests in the
722
- current ns. If PROMPT-FOR-SELECTOR is non-nil, prompt the user for
723
- a test selector to filter the tests with."
729
+ current ns. If PROMPT-FOR-FILTERS is non-nil, prompt the user for
730
+ test selectors to filter the tests with."
724
731
(interactive " P" )
725
732
(if-let* ((ns (if suppress-inference
726
733
(cider-current-ns t )
727
734
(funcall cider-test-infer-test-ns (cider-current-ns t )))))
728
- (cider-test-execute ns nil silent prompt-for-selector )
735
+ (cider-test-execute ns nil silent prompt-for-filters )
729
736
(if (eq major-mode 'cider-test-report-mode )
730
737
(when (y-or-n-p (concat " Test report does not define a namespace. "
731
738
" Rerun failed/erring tests?" ))
0 commit comments