Skip to content
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

Explore only previously matched branch when visiting partially satisfied OR expectation #3904

Merged
merged 4 commits into from Jun 29, 2020

Conversation

ioleo
Copy link
Member

@ioleo ioleo commented Jun 28, 2020

Fixes #3769

Also adds debugging that can be enabled by ZIO_TEST_MOCK_DEBUG=true test. It will come in handy when analysing potential future issues or new features.

/cc @adamgfraser @renancaju

* sbt -Dzio.test.mock.debug=true test
* }}}
*/
final val `zio.test.mock.debug` = "zio.test.mock.debug"
Copy link
Member

Choose a reason for hiding this comment

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

If possible, can we configure this through a TestAspect? We don't normally use system properties for anything in the library.

Copy link
Member Author

@ioleo ioleo Jun 28, 2020

Choose a reason for hiding this comment

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

It would require threading the TestAspect information to mock execution, not sure if possible without major refactoring.
It apprears System.properties fails to link on ScalaJS, so I switched to env variable instead.

This debug information is not really intended for the end user, but to library developers when extending/debugging the Mocking framework itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be a user facing feature at all? Maybe it should just be a private val that contributors can set to true for debugging purposes when developing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, that will work too. Updated code.

@ioleo ioleo changed the title Explore only partially satisfied branches in OR nodes. Explore only previoysly matched branch when visiting partially satisfied OR expectation Jun 28, 2020
@ioleo ioleo changed the title Explore only previoysly matched branch when visiting partially satisfied OR expectation Explore only previously matched branch when visiting partially satisfied OR expectation Jun 28, 2020
@adamgfraser adamgfraser merged commit 0e9db93 into zio:master Jun 29, 2020
@ioleo ioleo deleted the fix-3769 branch July 1, 2020 10:32
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.

ZIO Test Mocks - or with andThen apparently not working as expected
3 participants