summaryrefslogtreecommitdiff
path: root/cider-test.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2018-06-30 20:33:55 +0200
committerBozhidar Batsov <bozhidar@batsov.com>2018-06-30 20:33:55 +0200
commitc658d8a759adc187da70efaacf800fdc0f852021 (patch)
treeef69001d7f4f5d6c6b84eb02b9e25312ba955e4e /cider-test.el
parentbaae33267c94d2462cb08d7b3db7514d37df3d1f (diff)
[Fix #2357] Don't add nil keys to the test op requests
They don't make sense and can mess up the request handling on the nREPl side.
Diffstat (limited to 'cider-test.el')
-rw-r--r--cider-test.el80
1 files changed, 41 insertions, 39 deletions
diff --git a/cider-test.el b/cider-test.el
index 076b97aa..d5765784 100644
--- a/cider-test.el
+++ b/cider-test.el
@@ -648,45 +648,47 @@ The include/exclude selectors will be used to filter the tests before
;; 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
- `("op" ,(cond ((stringp ns) "test")
- ((eq :project ns) "test-all")
- ((eq :loaded ns) "test-all")
- ((eq :non-passing ns) "retest"))
- "include" ,(when (listp include-selectors) include-selectors)
- "exclude" ,(when (listp exclude-selectors) exclude-selectors)
- "ns" ,(when (stringp ns) ns)
- "tests" ,(when (stringp ns) tests)
- "load?" ,(when (or (stringp ns) (eq :project ns)) "true"))
- (lambda (response)
- (nrepl-dbind-response response (summary results status out err)
- (cond ((member "namespace-not-found" status)
- (unless silent
- (message "No test namespace: %s" (cider-propertize ns 'ns))))
- (out (cider-emit-interactive-eval-output out))
- (err (cider-emit-interactive-eval-err-output err))
- (results
- (nrepl-dbind-response summary (error fail)
- (setq cider-test-last-summary summary)
- (setq cider-test-last-results results)
- (cider-test-highlight-problems results)
- (cider-test-echo-summary summary results)
- (if (or (not (zerop (+ error fail)))
- cider-test-show-report-on-success)
- (cider-test-render-report
- (cider-popup-buffer
- cider-test-report-buffer
- cider-auto-select-test-report-buffer)
- summary
- results)
- (when (get-buffer cider-test-report-buffer)
- (with-current-buffer cider-test-report-buffer
- (let ((inhibit-read-only t))
- (erase-buffer)))
- (cider-test-render-report
- cider-test-report-buffer
- summary results))))))))
- conn)))))
+ (let* ((request `("op" ,(cond ((stringp ns) "test")
+ ((eq :project ns) "test-all")
+ ((eq :loaded ns) "test-all")
+ ((eq :non-passing ns) "retest"))))
+ ;; we add optional parts of the request only when relevant
+ (request (when (and (listp include-selectors) include-selectors) (append request `("include" ,include-selectors))))
+ (request (when (and (listp exclude-selectors) exclude-selectors) (append request `("exclude" ,exclude-selectors))))
+ (request (when (stringp ns) (append request `("ns" ,ns))))
+ (request (when (stringp ns) (append request `("tests" ,tests))))
+ (request (when (or (stringp ns) (eq :project ns)) (append request `("load?" ,"true")))))
+ (cider-nrepl-send-request
+ request
+ (lambda (response)
+ (nrepl-dbind-response response (summary results status out err)
+ (cond ((member "namespace-not-found" status)
+ (unless silent
+ (message "No test namespace: %s" (cider-propertize ns 'ns))))
+ (out (cider-emit-interactive-eval-output out))
+ (err (cider-emit-interactive-eval-err-output err))
+ (results
+ (nrepl-dbind-response summary (error fail)
+ (setq cider-test-last-summary summary)
+ (setq cider-test-last-results results)
+ (cider-test-highlight-problems results)
+ (cider-test-echo-summary summary results)
+ (if (or (not (zerop (+ error fail)))
+ cider-test-show-report-on-success)
+ (cider-test-render-report
+ (cider-popup-buffer
+ cider-test-report-buffer
+ cider-auto-select-test-report-buffer)
+ summary
+ results)
+ (when (get-buffer cider-test-report-buffer)
+ (with-current-buffer cider-test-report-buffer
+ (let ((inhibit-read-only t))
+ (erase-buffer)))
+ (cider-test-render-report
+ cider-test-report-buffer
+ summary results))))))))
+ conn))))))
(defun cider-test-rerun-failed-tests ()
"Rerun failed and erring tests from the last test run."