Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ParZip8JvmTest from Kotest Plugin to Kotlin-test runtime #3246

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.Tuple8
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 ParZip8JvmTest : StringSpec({
class ParZip8JvmTest {
val threadName: suspend CoroutineScope.() -> String =
{ Thread.currentThread().name }

"parZip 8 returns to original context" {
@Test fun parZip8ReturnsToOriginalContext() = runTest {
val zipCtxName = "parZip8"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(8, NamedThreadFactory(zipCtxName)) }
Expand All @@ -47,7 +48,7 @@ class ParZip8JvmTest : StringSpec({

}

"parZip 8 returns to original context on failure" {
@Test fun parZip8ReturnsToOriginalContextOnFailure() = runTest {
val zipCtxName = "parZip8"
resourceScope {
val zipCtx = executor { Executors.newFixedThreadPool(8, NamedThreadFactory(zipCtxName)) }
Expand Down Expand Up @@ -159,7 +160,7 @@ class ParZip8JvmTest : StringSpec({
}
}

"parZip 8 finishes on single thread" {
@Test fun parZip8FinishesOnSingleThread() = runTest {
checkAll(Arb.string()) {
val res = resourceScope {
val ctx = singleThreadContext("single")
Expand All @@ -182,4 +183,4 @@ class ParZip8JvmTest : StringSpec({
}
}
}
})
}