Skip to content

Commit

Permalink
[Fix #2357] Don't add nil keys to the test op requests
Browse files Browse the repository at this point in the history
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 c658d8a
Showing 1 changed file with 41 additions and 39 deletions.
80 changes: 41 additions & 39 deletions cider-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit c658d8a

Please sign in to comment.