-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add function reference support for use with shouldThrow #111
Comments
An alternate, simpler approach could be to introduce a wrapper function that returns a lambda for use with For example: invoking { myThrowingFunction() } shouldThrow AnyException
fun invoking(f: () -> Unit): () -> Unit = f I guess ultimately what I'm trying to avoid is having to define a local interim variable that is then passed to |
I really like that idea, as it reduces the noise in tests. Can the |
This implements the second proposal in MarkusAmshove#111. The tests have been adjusted to showcase the new syntax.
This implements the second proposal in MarkusAmshove#111. The tests have been adjusted to showcase the new syntax.
As an alternative syntax to:
It would be really nice to add function reference syntax such as:
::myThrowingFunction shouldThrow AnyException
If the function takes in an argument it would then be:
I've hacked these implementations in my own project as:
I would be happy to clean it up, and submit a formal PR if this sort of feature interests you.
Thanks!
The text was updated successfully, but these errors were encountered: