-
Notifications
You must be signed in to change notification settings - Fork 403
Closed
Description
Hi,
I just started playing around with ScalaCheck and encountered a problem. The following does not terminate on my machine with ScalaCheck 1.13.[0|1]:
import org.scalacheck.Properties
import org.scalacheck.Prop.forAll
object HelloSpec extends Properties("Hello") {
def replaceLettersWithX(str: String) = {
def replaceLetter(ch: Char): Char = {
if (ch.isLetter) {
'X'
} else {
ch
}
}
str map replaceLetter
}
property("is actually the identity function") = forAll { (str: String) =>
val withX: String = replaceLettersWithX(str)
withX == str
}
}
With version 1.12.5, a counter-example is produced quickly. With the newer versions, it gets stuck in an infinite loop. I tried to debug it and it seems like once ScalaCheck has found a counter-example, it is trying to shrink it. The shrinking however only keeps replacing one 1-character string with another.
Metadata
Metadata
Assignees
Labels
No labels