Skip to content

Expected/actual values in REPL-run tests are not valid Clojure data #1280

Open
@temochka

Description

@temochka

When running tests in REPL via Calva’s various "Run test" commands, the "expected"/"actual" values printed in Calva’s REPL buffer are not valid Clojure data.

Example test

(deftest a-test
  (is (= {:foo "bar buz"} {:foo "buz bar"})))

Output

; Running test: a-test…
; FAIL in calva-bug.core-test/a-test (core_test.clj:6):
; expected:
{:foo bar buz}
; actual:
({:foo buz bar})
; 1 tests finished, problems found. 😭 errors: 0, failures: 1, ns: 1, vars: 1

Expected behavior

; Running test: a-test…
; FAIL in calva-bug.core-test/a-test (core_test.clj:6):
; expected:
{:foo "bar buz"}
; actual:
{:foo "buz bar"}
; 1 tests finished, problems found. 😭 errors: 0, failures: 1, ns: 1, vars: 1

Additional context

  • I was able to reproduce this on a clean lein new calva-bug project running a Leiningen REPL with the default profile using a single test provided above.
  • It is important to print values as a valid data, because it’s a common use-case to copy the actual data and update the test with it.
  • The actual result ends up being wrapped in a list for some reason, would be nice to get rid of this.
  • This looks as if the values are printed via print (for human consumption) instead of prn.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions