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 ParZip9JvmTest from Kotest Plugin to Kotlin-test runtime #3245

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.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({
}
}
}
})
}
Loading