test.check

clojure.test reporting is uninformative

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

The clojure.test reporting results in output like:

FAIL in (always-fail) (clojure_test.clj:18)
expected: result
  actual: false

Note that the file and line number are always clojure_test.clj:18 and the expected value is always the literal string "result".

I'm not sure what the right output would be for expected/actual, but the incorrect file and line reporting means that clojure-test-mode consistently highlights the wrong line.

Activity

Hide
Philip Potter added a comment -

I think this is because the assertion is checked by calling clojure.test/is. clojure.test/is is being called for its return value, but it has the side effect of reporting failures. It's a macro, and it takes the literal symbol "result" as its expected expression, and takes the current file and line number to attach to the failure. It's really designed to be called by user code, not library code.

Show
Philip Potter added a comment - I think this is because the assertion is checked by calling clojure.test/is. clojure.test/is is being called for its return value, but it has the side effect of reporting failures. It's a macro, and it takes the literal symbol "result" as its expected expression, and takes the current file and line number to attach to the failure. It's really designed to be called by user code, not library code.
Hide
John Walker added a comment -
Show
John Walker added a comment - Well, one solution would involve taking advantage of the report functionality. https://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj#L204 https://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj#L371

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: