Sorry, I must be a bit clumsy and miss something o...
# kotest
d
Sorry, I must be a bit clumsy and miss something obvious.
Copy code
val subject = intArrayOf()
val expected = intArrayOf()
subject shouldBeEqual expected
This fails because what I really intended to do was to use
contentEquals()
on the arrays. I don't seem to find a matcher to do just that, though?
v
Maybe
subject shouldBe expected
?
Hm, no, I think that would work if it were an
Array
, but not for
IntArray
d
Just tried it: it does seem to work for
IntArray
🤦‍♂️
v
Hm, no, looking at the code I'd say it should work.
It should get to the
else
in
eq
which uses
DefaultEq
which uses
asList
on
IntArray
Ah, no, but then it uses
==
😞
d
Still, my test passes
v
Ah, no that should work: https://pl.kotl.in/SPQMTG2vN
d
I'll just use
toList()
and compare that with
shouldContainExactly
as there is a list conversion happening anyway.
Thanks for helping me out!
v
I just tried
Copy code
val subject = intArrayOf()
val expected = intArrayOf()
subject shouldBe expected
and result was success
So exactly what you want, isn't it?
d
Yes