Kirill Zhukov
05/17/2023, 9:51 PMfun a(): Any = 1
fun b(): Any = ""
test("foo") {
a().shouldBeTypeOf<String>()
b().shouldBeTypeOf<String>()
}
output:
1 should be of type kotlin.String
Kirill Zhukov
05/17/2023, 9:51 PMEmil Kantis
05/17/2023, 9:56 PMEmil Kantis
05/17/2023, 9:57 PMKirill Zhukov
05/17/2023, 10:52 PMKirill Zhukov
05/17/2023, 10:52 PMKirill Zhukov
05/17/2023, 10:53 PM....SomeTests[jvm] > foo[jvm] FAILED
java.lang.AssertionError: 1 should be of type kotlin.String
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
at ....
Kirill Zhukov
05/17/2023, 10:54 PMEmil Kantis
05/17/2023, 11:19 PMshouldBeTypeOf
inlines code, and perhaps when running from CLI that is not translated properly into a good stacktrace. Can you try running from intellij?Kirill Zhukov
05/17/2023, 11:26 PM