Add scripted test for nested test classes/objects

This commit is contained in:
Antonio Cunei 2017-10-26 01:46:28 +02:00
parent b19bd33dc0
commit 24a463cc6b
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,8 @@
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.13.5" % "test"
version := "0.0.1"
name := "broken"
organization := "org.catastrophe"
//scalaVersion := "2.10.6"
scalaVersion := "2.12.3"

View File

@ -0,0 +1,25 @@
package q
//
// On 1.0.3+ this test will say:
// [info] + Nesting.startsWith: OK, passed 100 tests.
// [info] Passed: Total 1, Failed 0, Errors 0, Passed 1
//
// On 1.0.0 to 1.0.2 it will crash with:
// [error] java.lang.ClassNotFoundException: q.X.Y$
//
import org.scalacheck.{Prop, Properties}
import Prop.forAll
class U extends Properties("Nesting")
object X extends U {
property("startsWith") = forAll { (a: String, b: String) =>
(a+b).startsWith(a)
}
object Y extends U {
property("endsWith") = forAll { (a: String, b: String) =>
(a+b).endsWith(b)
}
}
}

View File

@ -0,0 +1,2 @@
> test