From d5b188ca702a783d3ad9a607c519c949e54e4f39 Mon Sep 17 00:00:00 2001 From: Simon Vergauwen Date: Sun, 14 Apr 2024 18:04:04 +0200 Subject: [PATCH] Regression in Arb.list? --- .../src/commonTest/kotlin/arrow/core/test/Generators.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt index 3c947fe22b5..3885baf1f0f 100644 --- a/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt +++ b/arrow-libs/core/arrow-core/src/commonTest/kotlin/arrow/core/test/Generators.kt @@ -7,6 +7,7 @@ import io.kotest.property.arbitrary.bind import io.kotest.property.arbitrary.boolean import io.kotest.property.arbitrary.choice import io.kotest.property.arbitrary.constant +import io.kotest.property.arbitrary.filter import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.list import io.kotest.property.arbitrary.set @@ -29,7 +30,9 @@ import kotlin.coroutines.startCoroutine // copied from kotest-extensions-arrow fun Arb.Companion.nonEmptyList(arb: Arb, range: IntRange = 0 .. 100): Arb> = - Arb.list(arb, max(range.first, 1) .. range.last).map { NonEmptyList(it) } + Arb.list(arb, max(range.first, 1) .. range.last) + .filter { it.isNotEmpty() } + .map { NonEmptyList(it) } fun Arb.Companion.nonEmptySet(arb: Arb, range: IntRange = 0 .. 100): Arb> = Arb.set(arb, max(range.first, 1) .. range.last).map { it.toNonEmptySetOrNull()!! }