-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make passthrough/1' and
func/1 into a
ret_spec`
#90
Make passthrough/1' and
func/1 into a
ret_spec`
#90
Conversation
@eproxus can I expect comments today, or I just can go to sleep? :) |
I don't have time to review all of it today anyway, so let's keep in touch later. 😃 |
sure thing, but please do not disappear for too long :-) |
I hope we can release 0.8 with all that plus matchers before the end of this year. |
Sounds reasonable. I'll review this as soon as I can, promise. 🙇 |
%%%============================================================================ | ||
|
||
%%% @private | ||
%%% @doc Provides expectation processing functions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between meck_ret_spec
and meck_expect
? Could they both be merged into the same module perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meck_ret_spec
specifies how to calculate a value that is returned by an expectation. meck_expect
represents an expectation that is defined by a list of meck_args_spec/meck_ret_spec pairs where every pair is akin to a function clause/ So these are two different abstraction though the latter using the former as a building block.
In general I create these different modules not because I just like to have lots of files :-), but because I prefer to have distinct data abstractions with clean API and hidden implementation. I believe that greatly improves readability of the code..
How about removing |
We certainly can make funs serve as a body of a function but, that would break backwards compatibility. and make another exception in ret spec definition. now any X that you specify derectly is treated as meck:val(X) no exceptions. With you propousal we will have exception from that rule. Which means that users of the meck would need to remember that exception. So it is you call, but I would recommend to stick with meck:fun. less exceptions from general rules we have the better I think. |
@eproxus Hi Adam, it has been awhile since I provided my answers. So what do you think? |
I usually prefer conciseness in API's, especially for stuff that is often used. I think wrapping funs in |
But what about backwards compatibility? Now if you specify ret-spec as Maxim Vladimirsky
|
Ok, I will make that change and let you know when it is ready. Probably Maxim Vladimirsky
|
Hmm, so far this has never made it into a proper 0.X release, so I wouldn't worry about backwards compatibility. |
Ok. It also occurred to me that it does resemble more the former On Thu, Dec 13, 2012 at 2:51 PM, Adam Lindberg notifications@github.comwrote:
|
Closed as a not extendable pull request. It continues as #91. |
introduced two new
ret_spec()
kinds that aremeck:passthrough/0
andmeck:func/1
that make the following possible:That comes pretty handy given that you can specify them within
meck:seq/1
andmeck:loop/1
Besides all
ret_spec()
aware code was moved to a module of the same name.