Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Failed prerequisites with wrong lazy sequence does not print out the lazy sequenceΒ #464

@dfbernal

Description

@dfbernal

When evaluating a prerequisite that expects a certain lazy sequence Midje correctly fails when the lazy sequence does not match the expectation but does not return what the lazy sequence was. The following code demonstrates this:

(defn bar [lst]
  nil)

(defn foo []
  (bar (map #(hash-map :n %) [1 2])))

(fact "test"
  (foo) => [4 5]
  (provided (bar [1 2]) => [4 5]))

And the output is:

FAIL at (core.clj:10)
You never said #'bar would be called with these arguments:
    ["<an unrealized lazy sequence>"]

FAIL at (core.clj:10)
These calls were not made the right number of times:
    (bar [1 2]) [expected at least once, actually never called]

FAIL test at (core.clj:9)
Expected:
[4 5]
Actual:
"`bar` returned this string because it was called with an unexpected argument"

It would be very useful to see what the called parameters were instead of having the test output indicate that it was an unrealized lazy sequence. It would help when debugging since it allows you to see what the code was sending to the prerequisite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions