Skip to content

Commit

Permalink
Bump to Kotest 5 M2 (#2536)
Browse files Browse the repository at this point in the history
  • Loading branch information
nomisRev committed Sep 23, 2021
1 parent db38c70 commit fac6b36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -5,8 +5,8 @@ import arrow.core.Tuple4
import arrow.core.Tuple5
import arrow.core.test.generators.unit
import arrow.core.test.laws.Law
import io.kotest.core.names.TestName
import io.kotest.core.spec.style.StringSpec
import io.kotest.core.test.createTestName
import io.kotest.property.Arb
import io.kotest.property.Gen
import io.kotest.property.PropertyContext
Expand Down Expand Up @@ -34,7 +34,7 @@ public abstract class UnitSpec(
Arb.KList(gen, range)

public fun <A> Arb.Companion.nonEmptyList(arb: Arb<A>, depth: Int = maxDepth): Arb<NonEmptyList<A>> =
Arb.list(arb, 1..max(1, maxDepth)).filter(List<A>::isNotEmpty).map(NonEmptyList.Companion::fromListUnsafe)
Arb.list(arb, 1..max(1, depth)).filter(List<A>::isNotEmpty).map(NonEmptyList.Companion::fromListUnsafe)

public fun <A> Arb.Companion.sequence(arbA: Arb<A>, range: IntRange = 0..maxDepth): Arb<Sequence<A>> =
Arb.list(arbA, range).map { it.asSequence() }
Expand All @@ -59,14 +59,14 @@ public abstract class UnitSpec(
.flatMap { list: List<Law> -> list.asIterable() }
.distinctBy { law: Law -> law.name }
.forEach { law: Law ->
registration().addTest(createTestName(law.name), xdisabled = false, law.test)
registration().addTest(TestName(law.name), xdisabled = false, law.test)
}

public fun testLaws(prefix: String, vararg laws: List<Law>): Unit = laws
.flatMap { list: List<Law> -> list.asIterable() }
.distinctBy { law: Law -> law.name }
.forEach { law: Law ->
registration().addTest(createTestName(prefix, law.name, true), xdisabled = false, law.test)
registration().addTest(TestName(prefix, law.name, true), xdisabled = false, law.test)
}

public suspend fun checkAll(property: suspend PropertyContext.() -> Unit): PropertyContext =
Expand Down
2 changes: 1 addition & 1 deletion arrow-libs/gradle.properties
Expand Up @@ -23,7 +23,7 @@ JMH_REPORT_PLUGIN_VERSION=0.9.0
JUNIT_VERSION=4.12
JUNIT_VINTAGE_VERSION=5.5.2
KINDEDJ_VERSION=1.1.0
KOTEST_VERSION=5.0.0.M1
KOTEST_VERSION=5.0.0.M2
KOTEST_GRADLE_VERSION=5.0.0.5
KOTLIN_POET_VERSION=1.5.0
KOTLIN_TEST_VERSION=3.3.3
Expand Down

0 comments on commit fac6b36

Please sign in to comment.