EarthCitizen
12/13/2019, 3:22 PMval gen = object : Gen<String> {
override fun constants(): Iterable<String> = emptyList()
override fun random(seed: Long?): Sequence<String> = generateSequence { "abcdefghijklmnop" }
override fun shrinker(): Shrinker<String>? = object : Shrinker<String> {
override fun shrink(failure: String): List<String> = listOf("", "abcdef", "abcdefghijk")
}
}
shouldThrowAny {
assertAll(gen) { a ->
a.shouldHaveLength(0)
}
}
And this shrink log:
Attempting to io.kotest.properties.shrinking.shrink failed arg abcdefghijklmnop
Shrink #1: <empty string> pass
Shrink #2: abcdef fail
Shrink #3: abcdefghijk fail
Shrink result => abcdefghijk
Does this look like I bug to you? I was expecting the shrink result to be “abcdef” (the first failure after the last pass). The message in the failure is “Arg 0: abcdefghijk (shrunk from abcdefghijklmnop)“. Am I misunderstanding how the shrink should work?