Open
Conversation
fzhinkin
reviewed
Feb 27, 2026
| list.add(index) | ||
| builder.add(index) | ||
| assertEquals<List<*>>(list, builder.toList()) | ||
| check(list == builder.toList()) |
Collaborator
There was a problem hiding this comment.
check will throw IAE, Idea will not consider it a regular test failure and <Click to see difference> will be unavailable.
While it may not be an issue for assertion where two trivial values are compared, it will become an issue if two collections containing thousands of elements are not equal and you have to find the diff.
I would suggest waiting for a proper PA support from k-test and enable it then.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables the Kotlin Power Assert compiler plugin, which transforms assertion calls to include detailed diagnostic messages showing intermediate expression values on failure.
Power Assert injects a diagnostic message string as the last parameter of each configured assertion function. For
assertEquals(expected, actual)this string is always constructed eagerly, even when the assertion passes. This has no impact on contract and unit tests, but stress tests execute assertions inside tight loops with up to 1000000 iterations, making the constant string allocation a significant performance bottleneck.To fix this, assertions inside loops in stress tests are replaced with
checkequivalents (check(a == b)instead ofassertEquals(a, b)). UnlikeassertEquals,checkaccepts a lambda for its message, so the diagnostic string is only materialized on failure. Assertions outside loops and in non-stress tests are left unchanged for readability.kotlin.checkis already in the Power Assert functions list, so diagnostic output on failure is preserved.