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

Default Result Assertions Fix (again) #1429

Merged
merged 10 commits into from
May 8, 2023
Merged

Default Result Assertions Fix (again) #1429

merged 10 commits into from
May 8, 2023

Conversation

JordanllHarper
Copy link
Contributor


I confirm that I have read the Contributor Agreements v1.0, agree to be bound on them and confirm that my contribution is compliant.

@JordanllHarper JordanllHarper marked this pull request as ready for review May 6, 2023 20:46
Comment on lines 62 to 75
// @Test
// fun toBeAFailureResultFix() {
// val message = "wrong argument"
// val failure = Result.failure<Int>(IllegalArgumentException(message))
//
//
//
// expect(failure) {
// toBeAFailure<IllegalArgumentException>()
// }
//
//
// }
//
Copy link
Owner

Choose a reason for hiding this comment

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

remove this

Comment on lines 76 to 78
// @Test
// fun toBeAFailureFeature() {
// val message = "wrong argument"
Copy link
Owner

Choose a reason for hiding this comment

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

uncomment all the tests instead

// { apply { toBeAFailure.invoke(this) {} } }
// )
// ) {})
//TODO 0.20.0 activate once we have the workaround for #1234 implemented
Copy link
Owner

Choose a reason for hiding this comment

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

remove todo

// }
// }
// }
//TODO 0.20.0 activate once we have the workaround for #1234 implemented
Copy link
Owner

Choose a reason for hiding this comment

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

remove todo

@robstoll robstoll merged commit 7f22d9c into robstoll:main May 8, 2023
Comment on lines +47 to +50
val maybeSubjectResult = container.maybeSubject.map {
onSuccess { null }
onFailure { it.cause }
}
Copy link
Owner

Choose a reason for hiding this comment

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

sorry, I did not really find the time beforehand to take a proper look. This code does nothign as your onSuccess and onFailure only perform side effects. They don't return something which means, maybeSubjectResult is the same as container.maybeSubject. You don't have to do anything. I will improve the code and let you know my result in the end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see the error I made sorry about that. Would the solution to be to return some sort of value from the success or failure states and check that?

Copy link
Owner

Choose a reason for hiding this comment

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

the statement doesn't do anything and you still have fixed the issue which means these lines we can just delete :)

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