Chad Moller
08/03/2022, 8:18 PMinline fun <T, R> T.assertSoftly(assertions: T.() -> R): R {
return io.kotest.assertions.assertSoftly { this.assertions() }
}
Are there any thoughts or objections about adding this to kotest, along with other similar scoping functions?
An example of its use:
val user = buildUser()
user.assertSoftly {
name shouldBe "Bob"
role shouldBe Role.ADMIN
}
sam
08/03/2022, 8:56 PMLeoColman
08/03/2022, 9:09 PMChad Moller
08/03/2022, 9:21 PMLeoColman
08/03/2022, 9:41 PMinline fun <S, T> S.assertSoftly(crossinline assertions: S.() -> T): T = assertSoftly( { assertions() } as () -> T )
Chad Moller
08/03/2022, 9:43 PMLeoColman
08/03/2022, 9:48 PMChad Moller
08/03/2022, 9:58 PMAshish Kumar Joy
08/04/2022, 4:32 AMsam
08/04/2022, 6:43 AMLeoColman
08/04/2022, 3:06 PMSpec
as this
if you want to use the other caseChad Moller
08/04/2022, 3:19 PMsam
08/04/2022, 3:21 PMChad Moller
08/04/2022, 3:23 PMsam
08/04/2022, 3:23 PMChad Moller
08/04/2022, 3:23 PMLeoColman
08/04/2022, 5:03 PMapplySoftly
sounds cuteassertedSoftly
?"foo".assertedSoftly { }
foo.assertingSoftly{}
Chad Moller
08/04/2022, 5:04 PMsam
08/05/2022, 4:47 AMassertSoftly(object) { }
LeoColman
08/05/2022, 1:57 PM