Skip to content

Commit 017ecc8

Browse files
authored
cider-test: make test vars in test results reports clickable (#3583)
Fixes #3580
1 parent 1b97fe3 commit 017ecc8

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
- [#3576](https://github.com/clojure-emacs/cider/issues/3576): CIDER [Inspector](https://docs.cider.mx/cider/debugging/inspector.html): display Java class/method/field block tags (Returns/Throws/Params info) when available.
88
- CIDER [Inspector](https://docs.cider.mx/cider/debugging/inspector.html): retain [`truncate-lines`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Line-Truncation.html) values across screens.
9+
- [#3580](https://github.com/clojure-emacs/cider/issues/3580): `cider-test`: make test vars in [test results reports](https://docs.cider.mx/cider/testing/test_reports.html) clickable.
10+
- As defined in the newly introduced `cider-test-var-keymap` var.
911

1012
## 1.11.1 (2023-11-11)
1113

cider-test.el

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
407407
(and (string-match-p "\\\\n" input-string)
408408
t)))
409409

410+
(defvar cider-test-var-keymap
411+
(let ((map (make-sparse-keymap)))
412+
(define-key map [mouse-1] #'cider-test-jump)
413+
map))
414+
410415
(defun cider-test-render-assertion (buffer test)
411416
"Emit into BUFFER report detail for the TEST assertion."
412417
(with-current-buffer buffer
@@ -428,7 +433,9 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
428433
(type-face (cider-test-type-simple-face type))
429434
(bg `(:background ,cider-test-items-background-color :extend t)))
430435
(cider-insert (capitalize type) type-face nil " in ")
431-
(cider-insert var 'font-lock-function-name-face t)
436+
(cider-propertize-region `(keymap ,cider-test-var-keymap)
437+
(cider-insert (propertize var 'mouse-face 'highlight)
438+
'font-lock-function-name-face t))
432439
(when context (cider-insert context 'font-lock-doc-face t))
433440
(when message (cider-insert message 'font-lock-string-face t))
434441
(when expected

doc/modules/ROOT/pages/testing/test_reports.adoc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,51 @@ Calling test commands again will update the test report.
1111
TIP: You can also xref:testing/running_tests.adoc#display-test-report-on-success[configure test reports to be displayed on success].
1212

1313
|===
14-
| Keyboard shortcut | Description
14+
| Keyboard shortcut | Command name | Description
1515

1616
| kbd:[g]
17+
| `cider-test-run-test`
1718
| Run test at point.
1819

1920
| kbd:[n]
21+
| `cider-test-run-ns-tests`
2022
| Run tests for current namespace.
2123

2224
| kbd:[s]
25+
| `cider-test-run-ns-tests-with-filters`
2326
| Run tests for current namespace with selector filter.
2427

2528
| kbd:[l]
29+
| `cider-test-run-loaded-tests`
2630
| Run tests for all loaded namespaces.
2731

2832
| kbd:[p]
33+
| `cider-test-run-project-tests`
2934
| Run tests for all project namespaces. This loads the additional namespaces.
3035

3136
| kbd:[f]
37+
| `cider-test-rerun-failed-tests`
3238
| Re-run test failures/errors.
3339

3440
| kbd:[M-p]
41+
| `cider-test-previous-result`
3542
| Move point to previous test.
3643

3744
| kbd:[M-n]
45+
| `cider-test-next-result`
3846
| Move point to next test.
3947

40-
| kbd:[t] or kbd:[M-.]
48+
| kbd:[t] or kbd:[M-.] or kbd:click
49+
| `cider-test-jump`
4150
| Jump to test definition.
4251

4352
| kbd:[d]
53+
| `cider-test-ediff`
4454
| Display diff of actual vs expected.
4555

4656
| kbd:[e]
57+
| `cider-test-stacktrace`
4758
| Display test error cause and stacktrace info.
4859
|===
60+
61+
Most key bindings are defined in `cider-test-report-mode-map`, while the `click` behavior is defined in `cider-test-var-keymap`.

0 commit comments

Comments
 (0)