From 67f9c0f1a89e7440111bdbb76e1e4d6e8e349441 Mon Sep 17 00:00:00 2001 From: Marcus Ilgner Date: Thu, 26 Oct 2023 14:24:42 +0200 Subject: [PATCH] refactor: migrate NotEmptySetTest to kotlin-test (#3230) Co-authored-by: Alejandro Serrano --- .../kotlin/arrow/core/NonEmptySetTest.kt | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt index f90df187bec..9c50b8779fb 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/NonEmptySetTest.kt @@ -2,7 +2,6 @@ package arrow.core import arrow.core.test.nonEmptySet import io.kotest.assertions.withClue -import io.kotest.core.spec.style.StringSpec import io.kotest.matchers.booleans.shouldBeTrue import io.kotest.matchers.nulls.shouldNotBeNull import io.kotest.matchers.shouldBe @@ -10,36 +9,38 @@ import io.kotest.property.Arb import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.next import io.kotest.property.checkAll +import kotlin.test.Test +import kotlinx.coroutines.test.runTest -class NonEmptySetTest : StringSpec({ +class NonEmptySetTest { - "iterable.toNonEmptySetOrNull should round trip" { + @Test fun iterableToNonEmptySetOrNullShouldRoundTrip() = runTest { checkAll(Arb.nonEmptySet(Arb.int())) { nonEmptySet -> nonEmptySet.toNonEmptySetOrNull().shouldNotBeNull() shouldBe nonEmptySet } } - "iterable.toNonEmptySetOrNone should round trip" { + @Test fun iterableToNonEmptySetOrNoneShouldRoundTrip() = runTest { checkAll(Arb.nonEmptySet(Arb.int())) { nonEmptySet -> nonEmptySet.toNonEmptySetOrNone() shouldBe nonEmptySet.some() } } - "emptyList.toNonEmptySetOrNull should be null" { + @Test fun emptyListToNonEmptySetOrNullShouldBeNull() = runTest { listOf().toNonEmptySetOrNull() shouldBe null } - "emptyList.toNonEmptySetOrNone should be none" { + @Test fun emptyListToNonEmptySetOrNoneShouldBeNone() = runTest { listOf().toNonEmptySetOrNone() shouldBe none() } - "adding an element already present doesn't change the set" { + @Test fun addingAnElementAlreadyPresentDoesNotChangeTheSet() = runTest { val element = Arb.int().next() val initialSet: NonEmptySet = nonEmptySetOf(element) + Arb.nonEmptySet(Arb.int()).next() initialSet.plus(element) shouldBe initialSet } - "NonEmptySet equals Set" { + @Test fun nonEmptySetEqualsSet() = runTest { checkAll( Arb.nonEmptySet(Arb.int()) ) { nes -> @@ -51,7 +52,7 @@ class NonEmptySetTest : StringSpec({ } } - "NonEmptySet equals NonEmptySet" { + @Test fun nonEmptySetEqualsNonEmptySet() = runTest { checkAll( Arb.nonEmptySet(Arb.int()) ) { nes -> @@ -62,5 +63,5 @@ class NonEmptySetTest : StringSpec({ } } } -}) +}