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

Use the original failure when ErrorCollector contains single failure #3269

Merged
merged 2 commits into from Nov 19, 2022

Conversation

Kantis
Copy link
Member

@Kantis Kantis commented Oct 28, 2022

fixes #3236

AssertionFailedError is JVM-specific, so had to move some stuff to expect/actuals.

@Kantis Kantis added this to the 5.6 milestone Oct 28, 2022
@Kantis Kantis requested a review from a team October 28, 2022 23:10
@Kantis Kantis enabled auto-merge (squash) October 29, 2022 21:31
import io.kotest.matchers.should
import io.kotest.matchers.shouldBe

class ErrorCollectorTests : FreeSpec(
Copy link
Contributor

Choose a reason for hiding this comment

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

ah right there's no module for jsTest..

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what you meant with this 🤪 Did you mean that we should add a jsTest to check that I didn't break the js/desktop error collector?

Copy link
Contributor

@matejdro matejdro left a comment

Choose a reason for hiding this comment

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

Tested on my local machine and it seems to work fine. Made a comment for minor readability improvement.

actual fun ErrorCollector.collectiveError(): AssertionError? {
val failures = errors()
clear()
return if (failures.isNotEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be written cleaner as a when or else if statement instead of nested if?

Copy link
Member Author

Choose a reason for hiding this comment

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

It could, yeah.. I'll do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done :)

@Kantis Kantis force-pushed the issue-3236/return-original-assertion-failure branch from ad8ae74 to 7806e5b Compare November 19, 2022 15:17
@Kantis Kantis merged commit bdb0320 into master Nov 19, 2022
@Kantis Kantis deleted the issue-3236/return-original-assertion-failure branch November 19, 2022 15:53
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.

throw AssertionFailedError when shouldBe is the only failure in the assertSoftly block
3 participants