-
Couldn't load subscription status.
- Fork 1.4k
ZIO Test: Simplify TestAspect#around #1718
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
Conversation
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.
Nice! I didn't follow the dev of TestAspect but this tagging idiom is super elegant.
|
Yes, @jdegoes came up with it. It is really nice. |
| /** | ||
| * Constructs an aspect that evaluates every test inside the context of a `Managed`. | ||
| */ | ||
| def around[R0, E0](managed: ZManaged[R0, E0, Any]) = |
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.
Since the ZManaged returns Any, what about taking before and after directly, then we can wrap them into a managed inside this function and pass them to the other aroundTest? Less work for user.
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.
I like it. Let me make that change now.
|
Done. |
|
@jdegoes Are you good with this? |
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.
Looks great!
|
Improvement to the default behavior, and breaking, but worth it, I think! |
* simplify TestAspect#around * address review comments
Simplifies the type signature of
TestAspect#aroundso it becomes a combined version ofTestAspect#beforeandTestAspect#afterwhere thebeforeandaftereffects correspond to theacquireandreleaseeffects of the specifiedManaged. The existing version that also allows for modifying the test result goes toTestAspect#aroundTest.