-
Notifications
You must be signed in to change notification settings - Fork 685
Closed
Labels
bug 🐛Issues that report a problem or error in the code.Issues that report a problem or error in the code.
Description
Which version of Kotest are you using
Tested with kotest 5.9.1, kotlin 2.1.0
Test case
import io.kotest.core.spec.style.FreeSpec
import io.kotest.property.Arb
import io.kotest.property.arbitrary.bind
import io.kotest.property.forAll
data class Foo(val bar: Bar?)
data class Bar(val baz: String)
class PropertyTestCustomARb : FreeSpec({
val arbBarNotNull = Arb.bind<Bar>()
val arbFooWithBar: Arb<Foo> = Arb.bind<Foo> {
bind(Foo::bar to arbBarNotNull) // field should never be null since its Arb does not generate nulls
}
"bar should never be null" {
forAll(arbBarNotNull) { bar ->
bar != null
}
}
"foo with bar should have bar" {
forAll(arbFooWithBar) { foo ->
foo.bar != null // fails
}
}
})
Metadata
Metadata
Assignees
Labels
bug 🐛Issues that report a problem or error in the code.Issues that report a problem or error in the code.