diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/raise/IorSpec.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/raise/IorSpec.kt index 007135ee848..d9e2554a0a4 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/raise/IorSpec.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/raise/IorSpec.kt @@ -4,21 +4,22 @@ import arrow.core.Either import arrow.core.Ior import arrow.core.test.nonEmptyList import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.shouldBe import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.checkAll +import kotlin.test.Test import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll +import kotlinx.coroutines.test.runTest @Suppress( "UNREACHABLE_CODE", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION", "UNUSED_VARIABLE" ) -class IorSpec : StringSpec({ - "Accumulates" { +class IorSpec { + @Test fun accumulates() = runTest { ior(String::plus) { val one = Ior.Both("Hello", 1).bind() val two = Ior.Both(", World!", 2).bind() @@ -26,7 +27,7 @@ class IorSpec : StringSpec({ } shouldBe Ior.Both("Hello, World!", 3) } - "Accumulates and short-circuits with Left" { + @Test fun accumulatesAndShortCircuitsWithLeft() = runTest { ior(String::plus) { val one = Ior.Both("Hello", 1).bind() val two: Int = Ior.Left(", World!").bind() @@ -34,7 +35,7 @@ class IorSpec : StringSpec({ } shouldBe Ior.Left("Hello, World!") } - "Accumulates with Either" { + @Test fun accumulatesWithEither() = runTest { ior(String::plus) { val one = Ior.Both("Hello", 1).bind() val two: Int = Either.Left(", World!").bind() @@ -42,7 +43,7 @@ class IorSpec : StringSpec({ } shouldBe Ior.Left("Hello, World!") } - "Concurrent - arrow.ior bind" { + @Test fun concurrentArrowIorBind() = runTest { checkAll(Arb.nonEmptyList(Arb.int())) { xs -> ior(List::plus) { xs.mapIndexed { index, s -> async { Ior.Both(listOf(s), index).bind() } }.awaitAll() @@ -51,7 +52,7 @@ class IorSpec : StringSpec({ } } - "Accumulates eagerly" { + @Test fun accumulatesEagerly() = runTest { ior(String::plus) { val one = Ior.Both("Hello", 1).bind() val two = Ior.Both(", World!", 2).bind() @@ -59,7 +60,7 @@ class IorSpec : StringSpec({ } shouldBe Ior.Both("Hello, World!", 3) } - "Accumulates with Either eagerly" { + @Test fun accumulatesWithEitherEagerly() = runTest { ior(String::plus) { val one = Ior.Both("Hello", 1).bind() val two: Int = Either.Left(", World!").bind() @@ -67,7 +68,7 @@ class IorSpec : StringSpec({ } shouldBe Ior.Left("Hello, World!") } - "Ior rethrows exception" { + @Test fun iorRethrowsException() = runTest { val boom = RuntimeException("Boom!") shouldThrow { ior(String::plus) { @@ -76,7 +77,7 @@ class IorSpec : StringSpec({ }.message shouldBe "Boom!" } - "Recover works as expected" { + @Test fun recoverWorksAsExpected() = runTest { ior(String::plus) { val one = recover({ Ior.Left("Hello").bind() }) { 1 } val two = Ior.Right(2).bind() @@ -84,4 +85,4 @@ class IorSpec : StringSpec({ one + two + three } shouldBe Ior.Both(", World", 6) } -}) +}