Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use Specs2 with Scalacheck to automate testing of String arguments?
    primarykey
    data
    text
    <p>The rewritten <a href="http://etorreborre.github.com/specs2/">specs2</a> testing framework for Scala integrates automated testing with <a href="http://code.google.com/p/scalacheck/">scalacheck</a>. The examples given in the specs2 documentation on how to use scalacheck together with specs2 either <a href="http://etorreborre.github.com/specs2/guide/org.specs2.guide.SpecStructure.html#ScalaCheck+values">use integers</a> or more complicated custom generators as in <a href="http://etorreborre.blogspot.com/2011/02/scalacheck-generator-for-json.html">eric's json example</a>.</p> <p>While trying to get a slightly less complicated example working, I'm struggling because I don't know how one would use specs2 and scalacheck if I want to generate String arguments instead of Integers. How would this Quickstart example</p> <p><pre><code> import org.scalacheck._</p> <p>object StringSpecification extends Properties("String") { property("startsWith") = Prop.forAll((a: String, b: String) => (a+b).startsWith(a))</p> <p>property("endsWith") = Prop.forAll((a: String, b: String) => (a+b).endsWith(b))</p> <p>// Is this really always true? property("concat") = Prop.forAll((a: String, b: String) => (a+b).length > a.length &amp;&amp; (a+b).length > b.length )</p> <p>property("substring") = Prop.forAll((a: String, b: String) => (a+b).substring(a.length) == b )</p> <p>property("substring") = Prop.forAll((a: String, b: String, c: String) => (a+b+c).substring(a.length, a.length+b.length) == b ) } </pre></code></p> <p>taken from the <a href="http://code.google.com/p/scalacheck/">scalacheck homepage</a> look, if it was written as Specs2 specification using the scalacheck integration?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload