dave08
04/29/2021, 10:13 AMResult
assertions don't all work anymore... they complain that Result<T>
can't be cast to T
... maybe the fact that my T
is nullable is the cause?christophsturm
04/29/2021, 10:30 AMdave08
04/29/2021, 10:50 AMchristophsturm
04/29/2021, 10:54 AMchristophsturm
04/29/2021, 10:55 AMdave08
04/29/2021, 10:56 AMrobfletcher
04/29/2021, 1:43 PMdave08
04/29/2021, 1:44 PMrobfletcher
04/29/2021, 1:44 PMrobfletcher
04/29/2021, 1:44 PMrobfletcher
04/29/2021, 1:44 PMrobfletcher
04/29/2021, 1:44 PMdave08
04/29/2021, 1:45 PMdave08
04/29/2021, 1:46 PMdave08
04/29/2021, 1:48 PMexpect {
that(result.isSuccess).isTrue()
that(result2.exceptionOrNull()).isNotNull().isA<UniqueFieldConstraintViolation>().and {
get(UniqueFieldConstraintViolation::fieldName).isEqualTo("field1")
}
that(result3.exceptionOrNull()).isNotNull().isA<UniqueFieldConstraintViolation>().and {
get(UniqueFieldConstraintViolation::fieldName).isEqualTo("field2")
}
}
robfletcher
04/29/2021, 1:49 PMdave08
04/29/2021, 1:49 PMdave08
04/29/2021, 1:52 PMfun <R> Assertion.Builder<Result<R>>.isSuccess(): Assertion.Builder<R> =
assert("is success") {
when {
it.isSuccess -> pass()
else -> fail(
description = "threw %s",
actual = it.exceptionOrNull(),
cause = it.exceptionOrNull()
)
}
}
.get("value") {
// WORKAROUND - Handle inline class bug. (This will also work when this bug is fixed)
val value = getOrThrow()
if (value is Result<*>)
@Suppress("UNCHECKED_CAST")
return@get value.getOrThrow() as R
// WORKAROUND - END
getOrThrow()
}
dave08
04/29/2021, 1:52 PMdave08
04/29/2021, 2:03 PMrobfletcher
04/29/2021, 2:04 PMdave08
04/29/2021, 2:06 PMdave08
04/29/2021, 2:06 PMdave08
04/29/2021, 2:06 PMrobfletcher
04/29/2021, 2:08 PMstrikt-gradle
modulerobfletcher
04/29/2021, 2:10 PMjava.lang.ClassCastException: class kotlin.Result$Failure cannot be cast to class kotlin.Result
so it may well be relateddave08
04/29/2021, 3:15 PMrobfletcher
04/29/2021, 3:56 PMgradleTestKit
but exclude the bundled Kotlin but I don’t think there isrobfletcher
04/29/2021, 3:58 PMstrikt-gradle
because the problem is the IR-compiled code from strikt-core
dave08
04/29/2021, 3:59 PMstrikt-gradle
from the rest and let it depend on an older version of core?robfletcher
04/29/2021, 3:59 PMrobfletcher
04/29/2021, 4:00 PMstrikt-gradle
alongside any other modules the version alignment would be pretty confusingrobfletcher
04/29/2021, 4:01 PMstrikt-gradle
robfletcher
04/29/2021, 4:01 PMResult.value
seemingly returning itself in some contextschristophsturm
04/29/2021, 4:02 PMrobfletcher
04/29/2021, 4:02 PMrobfletcher
04/29/2021, 4:07 PMrobfletcher
04/29/2021, 4:07 PMrobfletcher
04/29/2021, 5:49 PMResult
even worse