Skip to content

Commit

Permalink
Refactor ParZip5JvmTest from Kotest Plugin to Kotlin-test runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
chrsblck committed Oct 30, 2023
1 parent 6b794a9 commit 6e1d368
Showing 1 changed file with 6 additions and 7 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.Tuple5
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 ParZip5JvmTest : StringSpec({
class ParZip5JvmTest {
val threadName: suspend CoroutineScope.() -> String =
{ Thread.currentThread().name }

"parZip 5 returns to original context" {
@Test fun parZip5ReturnsToOriginalContext() = runTest {
val zipCtxName = "parZip5"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(5, NamedThreadFactory(zipCtxName)) }
Expand All @@ -40,10 +41,9 @@ class ParZip5JvmTest : StringSpec({
threadName() shouldStartWith "single"
}
}

}

"parZip 5 returns to original context on failure" {
@Test fun parZip5ReturnsToOriginalContextOnFailure() = runTest {
val zipCtxName = "parZip5"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(5, NamedThreadFactory(zipCtxName)) }
Expand Down Expand Up @@ -107,7 +107,7 @@ class ParZip5JvmTest : StringSpec({
}
}

"parZip 5 finishes on single thread" {
@Test fun parZip5FinishesOnSingleThread() = runTest {
checkAll(Arb.string()) {
val res = resourceScope {
val ctx = singleThreadContext("single")
Expand All @@ -127,4 +127,3 @@ class ParZip5JvmTest : StringSpec({
}
}
}
)

0 comments on commit 6e1d368

Please sign in to comment.