Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

Simplifies the type signature of TestAspect#around so it becomes a combined version of TestAspect#before and TestAspect#after where the before and after effects correspond to the acquire and release effects of the specified Managed. The existing version that also allows for modifying the test result goes to TestAspect#aroundTest.

@adamgfraser adamgfraser requested a review from jdegoes September 20, 2019 14:04
regiskuckaertz
regiskuckaertz previously approved these changes Sep 21, 2019
Copy link
Member

@regiskuckaertz regiskuckaertz left a 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.

@adamgfraser
Copy link
Contributor Author

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]) =
Copy link
Member

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.

Copy link
Contributor Author

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.

@adamgfraser
Copy link
Contributor Author

Done.

@adamgfraser
Copy link
Contributor Author

@jdegoes Are you good with this?

@adamgfraser adamgfraser requested a review from jdegoes September 23, 2019 19:53
Copy link
Member

@jdegoes jdegoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@jdegoes
Copy link
Member

jdegoes commented Oct 2, 2019

Improvement to the default behavior, and breaking, but worth it, I think!

@jdegoes jdegoes merged commit 459cab6 into zio:master Oct 2, 2019
@adamgfraser adamgfraser deleted the around branch October 2, 2019 22:35
Twizty pushed a commit to Twizty/zio that referenced this pull request Nov 13, 2019
* simplify TestAspect#around

* address review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants