branch: elpa/cider commit ab54769d5171c06f12034156b834ed7c95d29d0c Author: Lars Andersen <ex...@expez.com> Commit: Bozhidar Batsov <bozhi...@batsov.dev>
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. --- CHANGELOG.md | 4 ++++ cider-test.el | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88feafc5b7..05c436cbfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ ## master (unreleased) - Allow using `npx nbb` as `cider-nbb-command`. +### Changes + +- [#3281](https://github.com/clojure-emacs/cider/pull/3281): Replace newline chars with actual newlines in `*cider-test-report*` buffer, for prettier error messages. + ## 1.6.0 (2022-12-21) ### New features diff --git a/cider-test.el b/cider-test.el index f672b5d324..3770275b08 100644 --- a/cider-test.el +++ b/cider-test.el @@ -478,6 +478,12 @@ With the actual value, the outermost '(not ...)' s-expression is removed." (cider-test-render-assertion buffer test))))) vars)) results))) + ;; Replace any newline chars with actual newlines to make long error + ;; messages more readable + (goto-char (point-min)) + (while (search-forward "\\n" nil t) + (replace-match " +")) (goto-char (point-min)) (current-buffer))))