You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Midje adds a new kind of falsehood to Clojure: "data-laden". It's a typed map that contains the extra note output that the collection and chatty checkers put out. The problem is that Clojure predicates will treat data-laden falsehoods as truthy. That requires some care in the Midje code, but there's not much chance that it will affect user code. But there is some chance. Consider this:
The problem is that just produces a data-laden falsehood, which every? turns into true.
This can be avoided by using the has checker:
user=> (fact [[1] [2]] => (has every? (just [1])))
FAIL at (NO_SOURCE_PATH:1)
Actual result did not agree with the checking function.
Actual result: [[1] [2]]
Checking function: (has every? (just [1]))
false
The reason has works is that it "lifts" the quantifier so that it recognizes data-laden falsehoods.
That's all fine so long as people remember to use has. I don't like depending on that, especially when not remembering makes a fact pass when it shouldn't.
With the new reporting framework, it occurs to me we could have chatty and collection checkers emit notes when they discover a problem. At the end of a check, the emission framework would print the usual failure message plus any notes.
This introduces ugly state into the equation, but it's really just state that already exists. And there are already side-effecting emission functions scattered around the code.
The text was updated successfully, but these errors were encountered:
Yes, feels like data-laden falsehood would only be viable if it is completely abstracted from the user.
The fact that it bleeds through in a potential false positive is scary!
Emitting notes sounds interesting. I like that it seperates the concern of reporting and failure. I would hope that it makes some of the code around the complex failure representation simpler.
Midje adds a new kind of falsehood to Clojure: "data-laden". It's a typed map that contains the extra note output that the collection and chatty checkers put out. The problem is that Clojure predicates will treat data-laden falsehoods as truthy. That requires some care in the Midje code, but there's not much chance that it will affect user code. But there is some chance. Consider this:
The problem is that
just
produces a data-laden falsehood, whichevery?
turns intotrue
.This can be avoided by using the
has
checker:The reason
has
works is that it "lifts" the quantifier so that it recognizes data-laden falsehoods.That's all fine so long as people remember to use
has
. I don't like depending on that, especially when not remembering makes a fact pass when it shouldn't.With the new reporting framework, it occurs to me we could have chatty and collection checkers emit notes when they discover a problem. At the end of a check, the emission framework would print the usual failure message plus any notes.
This introduces ugly state into the equation, but it's really just state that already exists. And there are already side-effecting emission functions scattered around the code.
The text was updated successfully, but these errors were encountered: