Skip to content

Commit

Permalink
[Fix clojure-emacs#613] Add clojure.test integration.
Browse files Browse the repository at this point in the history
Add 'cider-test' to replace the venerable, now-retired 'clojure-test-mode'.
  • Loading branch information
jeffvalk authored and dgtized committed Jun 24, 2014
1 parent 2ad487e commit ec76d1e
Show file tree
Hide file tree
Showing 8 changed files with 486 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ of the 'all' filter on stacktraces.
for presenting fontified documentation, including Javadoc.
* New interactive command `cider-toggle-trace`.
* `cider-select` can now switch to the `*cider-error*` buffer (bound to `x`).
* [#613](https://github.com/clojure-emacs/cider/issues/613) New `clojure.test'
integration.

### Changes

Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ Keyboard shortcut | Description
<kbd>C-c C-j</kbd> | Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
<kbd>C-c M-i</kbd> | Inspect expression. Will act on expression at point if present.
<kbd>C-c M-t</kbd> | Toggle var tracing.
<kbd>C-c ,</kbd> | Run tests for namespace.
<kbd>C-c C-,</kbd> | Re-run test failures/errors for namespace.
<kbd>C-c M-,</kbd> | Run test at point.
<kbd>M-.</kbd> | Jump to the definition of a symbol. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
<kbd>M-,</kbd> | Return to your pre-jump location.
<kbd>M-TAB</kbd> | Complete the symbol at point.
Expand Down Expand Up @@ -592,6 +595,19 @@ Keyboard shortcut | Description
<kbd>l</kbd> | pop to the parent object
<kbd>g</kbd> | refresh the inspector (e.g. if viewing an atom/ref/agent)

### cider-test-report-mode

Keyboard shortcut | Description
--------------------------------|-------------------------------
<kbd>C-c ,</kbd> | Run tests for namespace.
<kbd>C-c C-,</kbd> | Re-run test failures/errors for namespace.
<kbd>C-c M-,</kbd> | Run test at point.
<kbd>M-p</kbd> | Move point to previous test.
<kbd>M-n</kbd> | Move point to next test.
<kbd>t</kbd> and <kbd>M-.</kbd> | Jump to test definition.
<kbd>d</kbd> | Display diff of actual vs expected.
<kbd>e</kbd> | Display test error cause and stacktrace info.

### cider-stacktrace-mode

Keyboard shortcut | Description
Expand Down
9 changes: 9 additions & 0 deletions cider-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ Simply returns it if it's not a dict."
(-map '-cons-to-list (cdr val))
val))

(defun cider--dict-to-plist (val)
"Transforms a nREPL bdecoded dict VAL into a plist with symbol keys.
Simply returns it if it's not a dict."
(if (and (listp val)
(eq (car val) 'dict))
(-interleave (-map 'intern (-map 'car (cdr val)))
(-map 'cdr (cdr val)))
val))

(defun cider--var-choice (var-info)
"Prompt to choose from among multiple VAR-INFO candidates, if required.
This is needed only when the symbol queried is an unqualified host platform
Expand Down
8 changes: 5 additions & 3 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
(require 'cider-client)
(require 'cider-util)
(require 'cider-stacktrace)
(require 'cider-test)
(require 'cider-doc)

(require 'clojure-mode)
Expand Down Expand Up @@ -599,11 +600,12 @@ exists) is added as a prefix to LOCATION."
(message "No source available for %s" var))
(message "Symbol %s not resolved" var))))

(defun cider-jump-to-def (var)
"Jump to the definition of the VAR at point."
(defun cider-jump-to-def (var &optional line)
"Jump to the definition of the VAR, and optionally to the given LINE."
(cider-ensure-op-supported "info")
(-when-let (location (cider-get-def-location var))
(cider-jump-to-def-for location)))
(cider-jump-to-def-for location)
(when line (goto-line line))))

(defun cider-jump (query)
"Jump to the definition of QUERY."
Expand Down
3 changes: 3 additions & 0 deletions cider-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
(define-key map (kbd "C-c C-l") 'cider-load-file)
(define-key map (kbd "C-c C-b") 'cider-interrupt)
(define-key map (kbd "C-c C-j") 'cider-javadoc)
(define-key map (kbd "C-c ,") 'cider-test-run-tests)
(define-key map (kbd "C-c C-,") 'cider-test-rerun-tests)
(define-key map (kbd "C-c r") 'cider-test-show-report)
(define-key map (kbd "C-c M-s") 'cider-selector)
(define-key map (kbd "C-c M-r") 'cider-rotate-connection)
(define-key map (kbd "C-c M-d") 'cider-display-current-connection-info)
Expand Down
Loading

0 comments on commit ec76d1e

Please sign in to comment.