Skip to content

Commit

Permalink
Refactor ParZip7JvmTest from Kotest Plugin to Kotlin-test runtime (#3247
Browse files Browse the repository at this point in the history
)

Closes #3209

Co-authored-by: Alejandro Serrano <[email protected]>
  • Loading branch information
chrsblck and serras authored Nov 2, 2023
1 parent 1b8ec54 commit 74a9222
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package arrow.fx.coroutines
import arrow.core.Either
import arrow.core.Tuple7
import io.kotest.assertions.assertSoftly
import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.should
import io.kotest.matchers.string.shouldStartWith
import io.kotest.mpp.NamedThreadFactory
Expand All @@ -14,13 +13,15 @@ import io.kotest.property.checkAll
import java.util.concurrent.Executors
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withContext
import kotlin.test.Test

class ParZip7JvmTest : StringSpec({
class ParZip7JvmTest {
val threadName: suspend CoroutineScope.() -> String =
{ Thread.currentThread().name }

"parZip 7 returns to original context" {
@Test fun parZip7ReturnsToOriginalContext() = runTest {
val zipCtxName = "parZip7"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(7, NamedThreadFactory(zipCtxName)) }
Expand All @@ -46,7 +47,7 @@ class ParZip7JvmTest : StringSpec({
}
}

"parZip 7 returns to original context on failure" {
@Test fun parZip7ReturnsToOriginalContextOnFailure() = runTest {
val zipCtxName = "parZip7"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(7, NamedThreadFactory(zipCtxName)) }
Expand Down Expand Up @@ -141,7 +142,7 @@ class ParZip7JvmTest : StringSpec({
}
}

"parZip 7 finishes on single thread" {
@Test fun parZip7FinishesOnSingleThread() = runTest {
checkAll(Arb.string()) {
val res = resourceScope {
val ctx = singleThreadContext("single")
Expand All @@ -164,4 +165,3 @@ class ParZip7JvmTest : StringSpec({
}
}
}
)

0 comments on commit 74a9222

Please sign in to comment.