Skip to content

Commit 87b735f

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 b119912 commit 87b735f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
### New features
66

77
- [#3249](https://github.com/clojure-emacs/cider/pull/3249): Add support for Clojure Spec 2.
8-
- [#3247](https://github.com/clojure-emacs/cider/pull/3247) Add the `cider-stacktrace-analyze-at-point` and `cider-stacktrace-analyze-in-region` commands to view printed exceptions in the stacktrace inspector.
8+
- [#3247](https://github.com/clojure-emacs/cider/pull/3247): Add the `cider-stacktrace-analyze-at-point` and `cider-stacktrace-analyze-in-region` commands to view printed exceptions in the stacktrace inspector.
99

1010
### Changes
1111

1212
- Bump the injected nREPL version to 1.0.
13+
- [#3281](https://github.com/clojure-emacs/cider/pull/3281): Replace newline chars with actual newlines in `*cider-test-report*` buffer, for prettier error messages.
1314

1415
### Bugs fixed
1516

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)