Skip to content

Commit

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

Closes #3208
  • Loading branch information
chrsblck authored Nov 2, 2023
1 parent 1c9087d commit 1050868
Showing 1 changed file with 7 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.Tuple6
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 ParZip6JvmTest : StringSpec({
class ParZip6JvmTest {
val threadName: suspend CoroutineScope.() -> String =
{ Thread.currentThread().name }

"parZip 6 returns to original context" {
@Test fun parZip6ReturnsToOriginalContext() = runTest {
val zipCtxName = "parZip6"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(6, NamedThreadFactory(zipCtxName)) }
Expand All @@ -45,7 +46,7 @@ class ParZip6JvmTest : StringSpec({
}
}

"parZip 6 returns to original context on failure" {
@Test fun parZip6ReturnsToOriginalContextOnFailure() = runTest {
val zipCtxName = "parZip6"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(6, NamedThreadFactory(zipCtxName)) }
Expand Down Expand Up @@ -123,7 +124,7 @@ class ParZip6JvmTest : StringSpec({
}
}

"parZip 6 finishes on single thread" {
@Test fun parZip6FinishesOnSingleThread() = runTest {
checkAll(Arb.string()) {
val res = resourceScope {
val ctx = singleThreadContext("single")
Expand All @@ -136,4 +137,4 @@ class ParZip6JvmTest : StringSpec({
}
}
}
})
}

0 comments on commit 1050868

Please sign in to comment.