https://kotlinlang.org logo
#kotest
Title
# kotest
k

Klitos Kyriacou

10/03/2023, 4:25 PM
Is there a known limitation when using
checkAll
with arrays?
Copy code
class TestUsingCheckAllWithArray : FreeSpec({
    "test" {
        checkAll<Array<String>> {
            // whatever
        }
    }
})
This produces:
Copy code
java.lang.IllegalStateException: Could not locate a primary constructor for kotlin.Array
	at io.kotest.property.arbitrary.JvmbindKt.forClassUsingConstructor(jvmbind.kt:84)
	at io.kotest.property.arbitrary.TargetDefaultForClassNameKt.targetDefaultForType(targetDefaultForClassName.kt:73)
	at io.kotest.property.resolution.JvmArbResolver.resolve(platformArbResolver.kt:11)
	at io.kotest.property.resolution.ResolveKt.resolve(resolve.kt:28)
	at TestUsingCheckAllWithArray$1$1.invokeSuspend(MyTest.kt:34)
There is a workaround:
Copy code
checkAll<List<String>> {
            val array = it.toTypedArray()
            foo(array) shouldBe ...
        }
But it would be nice if it worked with Array directly.
s

sam

10/04/2023, 12:52 AM
We can add that
s

Seongil Kim

10/28/2023, 5:55 AM
https://github.com/kotest/kotest/pull/3728 @Klitos Kyriacou Merged! 🙂
thank you color 1
2 Views