Skip to content

Commit

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

Closes #3211
  • Loading branch information
chrsblck authored Oct 29, 2023
1 parent 99b1bf0 commit fdf6e99
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.Tuple9
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 @@ -13,14 +12,16 @@ import io.kotest.property.arbitrary.string
import io.kotest.property.checkAll
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.awaitCancellation
import kotlinx.coroutines.test.runTest
import kotlinx.coroutines.withContext
import kotlin.test.Test
import java.util.concurrent.Executors

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

"parZip 9 returns to original context" {
@Test fun parZip9ReturnsToOriginalContext() = runTest {
val zipCtxName = "parZip9"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(9, NamedThreadFactory(zipCtxName)) }
Expand Down Expand Up @@ -57,7 +58,7 @@ class ParZip9JvmTest : StringSpec({

}

"parZip 9 returns to original context on failure" {
@Test fun parZip9ReturnsToOriginalContextOnFailure() = runTest {
val zipCtxName = "parZip9"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(9, NamedThreadFactory(zipCtxName)) }
Expand Down Expand Up @@ -192,7 +193,7 @@ class ParZip9JvmTest : StringSpec({
}
}

"parZip 9 finishes on single thread" {
@Test fun parZip9FinishesOnSingleThread() = runTest {
checkAll(Arb.string()) {
val res = resourceScope {
parZip(
Expand All @@ -215,4 +216,4 @@ class ParZip9JvmTest : StringSpec({
}
}
}
})
}

0 comments on commit fdf6e99

Please sign in to comment.