Skip to content

Commit 6dd8193

Browse files
committed
Replace newline chars with newlines in test report
When the library / app under test returns long error messages on test failures it will often include newlines. These are today displayed as `\\n` and we get an error message on one very long line. This commit turns these newline characters into actual newlines, which makes the content of the `*cider-test-report*` buffer much more pleasant to read.
1 parent ae2c39f commit 6dd8193

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
## master (unreleased)
44
- Allow using `npx nbb` as `cider-nbb-command`.
55

6+
### Changes
7+
8+
- [#3281](https://github.com/clojure-emacs/cider/pull/3281): Replace newline chars with actual newlines in `*cider-test-report*` buffer, for prettier error messages.
9+
610
## 1.6.0 (2022-12-21)
711

812
### New features

cider-test.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,12 @@ With the actual value, the outermost '(not ...)' s-expression is removed."
478478
(cider-test-render-assertion buffer test)))))
479479
vars))
480480
results)))
481+
;; Replace any newline chars with actual newlines to make long error
482+
;; messages more readable
483+
(goto-char (point-min))
484+
(while (search-forward "\\n" nil t)
485+
(replace-match "
486+
"))
481487
(goto-char (point-min))
482488
(current-buffer))))
483489

0 commit comments

Comments
 (0)