willowtreeapps/assertk

Change signature for `containsAll()`

evant opened this issue · 5 comments

evant commented

right now it's containsAll(vararg Any?) which it makes it too easy to accidentally pass in listOf(foo) instead of *listOf(foo)

rf43 commented

Just curious about this... we could just have it throw an error (as it currently does). I could add another test to ensure that this behavior is kept and consistent.

Also, iirc - for now Kotlin only supports the spread operator for arrays *arrayOf(foo) and not collections like lists *listOf(foo)

evant commented

Hm good point, maybe a separate collection overload?

evant commented

Looks like this is impossible without https://youtrack.jetbrains.com/issue/KT-13198

Looks like a blocker. Can't think of a way around this 😕

containsAll(*listOf(...)) doesn't event work for me. Need to put .toTypedArray() on the end too. Deal-breaker. :(