Asq
12/20/2021, 11:34 PMshouldBe
is a List
, and the rhs is a home-grown Iterable
. This happens in IterablEq.kt
(kotest 5.0.3) as
fun isValidIterable(it: Any): Boolean {
return when (it) {
is List<*>, is Set<*>, is Array<*>, is Collection<*> -> true
else -> false
}
}
Could someone please help me understand why a custom implementation of Iterable
should not be considered a valid iterable for the purposes of kotest
?Jim
12/20/2021, 11:37 PMsam
12/20/2021, 11:58 PMJim
12/20/2021, 11:59 PMsam
12/21/2021, 12:01 AMlistOf(1,2,3) shouldBe myIterable(1,2,3)
listOf(1,2,3) shouldBe setOf(1,2,3)
shouldContainExactly
or whatevershouldIterateEquals
Jim
12/21/2021, 12:02 AMAsq
12/21/2021, 1:52 AMequals
(same hashcode) is a squishy thing to enforce, especially under inheritance. shouldBe
as it is at present is largely ambiguous, as it tries really really hard to make things work. Is it trying too hard?Jim
12/21/2021, 2:24 AMAsq
12/21/2021, 5:11 PM