Don't allow generated strings (key names) to be empty

This commit is contained in:
Dan Sanduleac 2014-05-20 08:34:28 +01:00
parent 5a0e962d8a
commit 4eafda7891
1 changed files with 5 additions and 2 deletions

View File

@ -61,9 +61,12 @@ object SettingsTest extends Properties("settings") {
private def mkAttrKeys[T](nr: Int)(implicit mf: Manifest[T]): Gen[List[AttributeKey[T]]] =
{
val alphaStr = Gen.alphaStr
import Gen._
val nonEmptyAlphaStr =
nonEmptyListOf(alphaChar).map(_.mkString).suchThat(_.forall(_.isLetter))
for {
list <- Gen.listOfN(nr, alphaStr) suchThat (l => l.size == l.distinct.size)
list <- Gen.listOfN(nr, nonEmptyAlphaStr) suchThat (l => l.size == l.distinct.size)
item <- list
} yield AttributeKey[T](item)
}