From 85c200009e9afb9fad0f3ff0ee7b7082c47b70de Mon Sep 17 00:00:00 2001 From: Chris Black <2538545+chrsblck@users.noreply.github.com> Date: Thu, 2 Nov 2023 02:42:20 -0700 Subject: [PATCH] Refactor ParZip5JvmTest from Kotest Plugin to Kotlin-test runtime (#3256) Closes #3207 --- .../kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt index 34596e56a88..98ede0dcf03 100644 --- a/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt +++ b/arrow-libs/fx/arrow-fx-coroutines/src/jvmTest/kotlin/arrow/fx/coroutines/ParZip5JvmTest.kt @@ -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 @@ -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)) } @@ -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)) } @@ -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") @@ -127,4 +127,3 @@ class ParZip5JvmTest : StringSpec({ } } } -)