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

io.kotlintest.Result conflicts with kotlin.Result #898

Closed
lwasyl opened this issue Jul 17, 2019 · 6 comments
Closed

io.kotlintest.Result conflicts with kotlin.Result #898

lwasyl opened this issue Jul 17, 2019 · 6 comments
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones.
Milestone

Comments

@lwasyl
Copy link
Contributor

lwasyl commented Jul 17, 2019

Kotlin's kotlin.Result class is being resolved without an import. So for example copy-pasting sample custom matcher fails, because IDE doesn't prompt for import, and implictly uses Kotlin's Result.

Since the library is dedicated for Kotlin language, perhaps it'd make sense to rename io.kotlintest.Result to e.g. TestResult or AssertionResult to avoid the clash. It's not a big problem right now, but as inline classes graduate from experimental, I expect more usages of kotlin.Result, and the issue might become annoying

@sksamuel
Copy link
Member

This is a good point.

It's a breaking change for anyone who uses custom matchers though. Perhaps we do it and bump to version 4.0.

Or maybe we do it in 3.4 (releasing in the next few days) and deprecate Result buying us some time.

@sksamuel sksamuel added discussion enhancement ✨ Suggestions for adding new features or improving existing ones. labels Jul 17, 2019
@lwasyl
Copy link
Contributor Author

lwasyl commented Jul 17, 2019

+1 for introducing an alias and deprecating the current Result right away.

With that perhaps there are other changes to Result that were suggested at some point? One pain point (to me) is having to specify both failure and negated failure messages. Also the messages are evaluated eagerly, which is less flexible than providing them in functions for example. (edit: they're not 🤦‍♂️)

@sksamuel
Copy link
Member

sksamuel commented Jul 17, 2019 via email

@sksamuel
Copy link
Member

Ok so in 3.4 Result is now MatcherResult, and it explicitly allows functions to keep them lazy.

@fsonntag
Copy link

fsonntag commented Sep 4, 2019

I realized that io.kotlintest.Result is now replaced with MatcherResult
It would be great to update the docs, as it is explicitly used there for writing custom matchers

@sksamuel
Copy link
Member

sksamuel commented Sep 4, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones.
Projects
None yet
Development

No branches or pull requests

3 participants