Skip to content
Permalink
Browse files

[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.
  • Loading branch information
bbatsov committed Jun 30, 2018
1 parent baae332 commit c658d8a759adc187da70efaacf800fdc0f852021
Showing with 41 additions and 39 deletions.
  1. +41 −39 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."

0 comments on commit c658d8a

Please sign in to comment.
You can’t perform that action at this time.