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

Expressive Arrow Try Asserts #890

Merged
merged 1 commit into from
Jul 15, 2019
Merged

Expressive Arrow Try Asserts #890

merged 1 commit into from
Jul 15, 2019

Conversation

tibtof
Copy link
Contributor

@tibtof tibtof commented Jul 15, 2019

I tried the assertions today and I felt that the assertion can be a bit more expressive.
I added some more asserts, usage examples can be found in tests.
I had a bit of a dilemma when testing success/failure values, between:
Try.Success("foo") shouldBeSuccess { it shouldBe "foo" }
and
Try.Success("foo") shouldBeSuccess { this shouldBe "foo" }

I also noticed that diffs are not properly highlighted in IntelliJ for shouldBeSuccess [value]. That's why I delegated testing failure equality to equalityMatcher. The result can be compared easier with IntelliJ, at the cost of losing the Failure() wrapper.

Other changes:

  • use contracts to expose Failure was failing, I added a data class Exception to fix it
  • added .editorconfig with some basic rules

@sksamuel
Copy link
Member

Thanks for the editor config. Very useful as this project is 2 spaces :)

I think it is better than this, so that's good. Great PR.

@sksamuel sksamuel merged commit 0170bea into kotest:master Jul 15, 2019
@tibtof
Copy link
Contributor Author

tibtof commented Jul 15, 2019

Hi @sksamuel, thanks for merging my PR. I could try to add this kind of asserts to other Arrow types in the next few days if you think it's useful. I only use it for Try right now.

@sksamuel
Copy link
Member

I think the others already have them. At least Either definitely does as I added it myself.

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.

2 participants