-
-
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
Feature/new exception syntax #74
Conversation
This is awesome! Feature/API wise it looks really good, I'll review the code as soon as I have a bit more time. |
I hope that won't take long :) |
{meck_func, fun()} | | ||
{meck_raise, throw | error | exit, term()} | | ||
term(). |
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_val, term()}
and just term()
?
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.
There is no difference. So we probably can remove it all together. But I would leave meck:val/1 function anyway. I use it in my unit tests just to clearly see where I specify ret spec as plain value.
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.
Yeah, since one always use the functions instead of the tuples, I think it's okay to leave it.
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.
ok, then :)
@eproxus so, do I need to fix something here? |
Nope, I'll just wait for Travis CI to run the tests (or run them myself) and then I'll merge. |
@eproxus If you go to the Meck page at Travis CI http://travis-ci.org/#!/eproxus/meck/pull_requests you will see that build passed. There is no a note in here about that though. Probably due to some glitch in GitHub/Travis integration. |
Ah, I was fooled by looking for the name of the pull request rather than the last commit message. My bad. Merging now. |
This pull requests suggests a new exception expectation syntax in the spirit of just merged to the develop args-filter feature.
It introduces a new
ret_spec()
constructionmeck:raise(Class, Reason)
that can be specified anywhere where aret_spec()
is expected. E.g:Moreover it is possible to specify
meck:raise
inside ofmeck:loop
andmeck:seq
specifications. E.g.:Technically
meck:seq
andmeck:loop
were turned into containers that can contain any validret_spec()
including themselves. That makes rather crazy expect specifications possible:But this is just a side-effect of the implementation that will probably never be used :)