seratch / scalatest

Automatically exported from code.google.com/p/scalatest
Apache License 2.0
0 stars 0 forks source link

Feature request: Some way to disable shrinking when using ScalaCheck #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
ScalaCheck provides the Prop.forAllNoShrink method as a way to disable the 
automatic shrinking feature. But it appears that ScalaTest's 
GeneratorDrivenPropertyChecks does not provide any way to access this behaviour.

I managed to work around it by defining my own Shrinks that do nothing, e.g.

  implicit val disableShrink: Shrink[String] = Shrink(s => Stream.empty) 

but this is pretty ugly.

I think adding a parameter to PropertyCheckConfig would be quite a clean 
solution.

Original issue reported on code.google.com by chris.bi...@gmail.com on 30 Nov 2012 at 9:20

GoogleCodeExporter commented 8 years ago
try this way:

import org.scalacheck.Prop.forAllNoShrink
import org.scalatest.prop.Checkers.check

 "xxxxx" should "yyyy" in {
    //...
    check {
      forAllNoShrink(....) { t =>
        // ....
        t == something
      }
    }
  }

Original comment by giovanni...@gmail.com on 19 Nov 2013 at 11:00

GoogleCodeExporter commented 8 years ago
Take a look at this post 
http://stackoverflow.com/questions/20037900/scalacheck-wont-properly-report-the-
failing-case

Original comment by giovanni...@gmail.com on 19 Nov 2013 at 11:06