Eager Any.toString()
in MatcherResult
#2454
Labels
assertions 🔍
Related to the assertion mechanisms within the testing framework.
bug 🐛
Issues that report a problem or error in the code.
Milestone
kotest version 4.6.0
Hi,
Some of my tests deal with huge data class and I found that they are slow & memory consuming because a lots of matchers indirectly call
Any.toString()
even if those tests didn't return any error.An exemple here :
kotest/kotest-assertions/kotest-assertions-core/src/commonMain/kotlin/io/kotest/matchers/nulls/matchers.kt
Line 104 in 0ba1498
A simple workarround could be using
io.kotest.matchers.MatcherResult.Companion#invoke(boolean, kotlin.jvm.functions.Function0<java.lang.String>, kotlin.jvm.functions.Function0<java.lang.String>)
instead of
io.kotest.matchers.MatcherResult.Companion#invoke(boolean, java.lang.String, java.lang.String)
The linked example would look like
I could make a PR if you do agree with me.
The text was updated successfully, but these errors were encountered: