Skip to content

Commit

Permalink
Combine properties in test
Browse files Browse the repository at this point in the history
Previously, only the last property would be verified and the others
would be ignored. This patch fixes the tests so that all properties are
verified.
  • Loading branch information
Duhemm committed Aug 30, 2024
1 parent 038fd54 commit 5a0d1fc
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package org.scalacheck

import org.scalacheck.Prop.proved
import org.scalacheck.Prop.{all, proved}
import sbt.testing.{Selector, SuiteSelector, TaskDef, TestSelector}

object ScalaCheckFrameworkSpecification extends Properties("ScalaCheckFramework") {
Expand All @@ -18,26 +18,26 @@ object ScalaCheckFrameworkSpecification extends Properties("ScalaCheckFramework"
private val secondProp = "ScalaCheckFrameworkHelper.second prop"
private val thirdProp = "ScalaCheckFrameworkHelper.third prop"

property("all props with SuiteSelector") = {
getPropNamesForSelectors(List(new SuiteSelector)) == List(firstProp, secondProp, thirdProp)
property("all props with SuiteSelector") = all(
getPropNamesForSelectors(List(new SuiteSelector)) == List(firstProp, secondProp, thirdProp),
getPropNamesForSelectors(List(new SuiteSelector, new TestSelector(firstProp))) == List(
firstProp,
secondProp,
thirdProp)
thirdProp),
getPropNamesForSelectors(List(new SuiteSelector, new TestSelector("no matches"))) == List(
firstProp,
secondProp,
thirdProp)
}
)

property("only matching props with TestSelector") = {
getPropNamesForSelectors(List(new TestSelector(firstProp))) == List(firstProp)
getPropNamesForSelectors(List(new TestSelector(secondProp))) == List(secondProp)
property("only matching props with TestSelector") = all(
getPropNamesForSelectors(List(new TestSelector(firstProp))) == List(firstProp),
getPropNamesForSelectors(List(new TestSelector(secondProp))) == List(secondProp),
getPropNamesForSelectors(List(new TestSelector(firstProp), new TestSelector(thirdProp))) == List(
firstProp,
thirdProp)
thirdProp),
getPropNamesForSelectors(List(new TestSelector("no matches"))) == Nil
}
)

private def getPropNamesForSelectors(selectors: List[Selector]): List[String] = {
val framework = new ScalaCheckFramework()
Expand Down

0 comments on commit 5a0d1fc

Please sign in to comment.