https://kotlinlang.org logo
Title
e

Emil Kantis

04/21/2023, 2:48 PM
I'm not really sure how we propose to do this instead? https://github.com/kotest/kotest/issues/3492 Shouldn't we change
shouldBeEqualToComparingFields
to handle standard collections?
E.g.: For List/Array: Considered equal if lengths are equal and each position contains an item which matches expected by comparing fields For Set: Considered equal if sizes are equal and each item in actual has an item which matches in expected by comparing fields For Map: considered equal if each entry in actual has a match in expected by comparing fields of
key
and
value
s

sam

04/21/2023, 2:57 PM
forAll ?
e

Emil Kantis

04/21/2023, 3:01 PM
Doesn't work if I want to check
class A(val b: B)
class B(val c: C)
class C(val ds: List<D>)
class D(val something: String, val other: Int)
and want to check that
a1
and
a2
are equal?
s

sam

04/21/2023, 3:01 PM
list.forAll { it.equal comaring fields ? }
e

Emil Kantis

04/21/2023, 3:01 PM
but the list is on the inner-most level
a1.b.c.d.forAll { it shouldEqualComparingfields a2.b.c.d }
(and then if there's other properties on other levels we have to check them by hand)