Merge pull request #1353 from dansanduleac/bugfix/failing-derived-settings-tests

SettingsTest: Don't allow generated strings (key names) to be empty
This commit is contained in:
Josh Suereth 2014-05-20 08:32:53 -04:00
commit d8a8792946
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]]] = 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 { 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 item <- list
} yield AttributeKey[T](item) } yield AttributeKey[T](item)
} }