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
I couldn't find a way to use prerequisites for functions with type hinted vars. The root cause is related to how type hint works and it comes down to some limitation of with-redefs as explained in #295.
However, as a midje user I am expecting some workaround (when using with-redefs the workaround is to type hint the mocking function).
Can someone think of a way to define prerequisites for the following scenario?
There is a workaround exposed here but it requires to modify the code of the function that is tested which is not desirable in my case.
Can someone think of a workaround (or maybe a fix in midje) that will allow me to use prerequisites for type hinted functions without modifying the source code.
I can confirm that this issue is also present in mockfn, which is a test-framework agnostic reimplementation of the best parts (in my opinion) of Midje's mocking capabilities
If you want to explore coming up with a fix for this, I would recommend trying to get it going in that project because it has a much smaller codebase than Midje
This is a cornercase that seems to be a nuance of how Clojure is implemented (as far as I understand), so I personally don't plan to dive into this at the moment.
I couldn't find a way to use prerequisites for functions with type hinted vars. The root cause is related to how type hint works and it comes down to some limitation of
with-redefs
as explained in #295.However, as a midje user I am expecting some workaround (when using
with-redefs
the workaround is to type hint the mocking function).Can someone think of a way to define prerequisites for the following scenario?
There is a workaround exposed here but it requires to modify the code of the function that is tested which is not desirable in my case.
Can someone think of a workaround (or maybe a fix in midje) that will allow me to use prerequisites for type hinted functions without modifying the source code.
Here is a simple illustration of my use case:
This code causes an exception:
While this code works as expected
The text was updated successfully, but these errors were encountered: