@@ -2631,7 +2631,7 @@ class GeneratorSpec extends FunSpec with Matchers {
2631
2631
}
2632
2632
2633
2633
import scala .collection .GenTraversable
2634
- import scala . collection . generic . GenericCompanion
2634
+ import org . scalactic . ColCompatHelper
2635
2635
/**
2636
2636
* A common test for how we do shrinking in the collection Generators.
2637
2637
*
@@ -2644,7 +2644,7 @@ class GeneratorSpec extends FunSpec with Matchers {
2644
2644
* @param generator the Generator for this collection type
2645
2645
* @tparam F the collection type we are testing
2646
2646
*/
2647
- def shrinkByStrategery [F [Int ] <: GenTraversable [Int ]](factory : GenericCompanion [ F ] )(implicit generator : Generator [F [Int ]]): Unit = {
2647
+ def shrinkByStrategery [F [Int ] <: GenTraversable [Int ]](factory : ColCompatHelper . Factory [ Int , F [ Int ]] )(implicit generator : Generator [F [Int ]]): Unit = {
2648
2648
import GeneratorDrivenPropertyChecks ._
2649
2649
val intGenerator = Generator .intGenerator
2650
2650
val (intCanonicalsIt, _) = intGenerator.canonicals(Randomizer .default)
@@ -2660,14 +2660,14 @@ class GeneratorSpec extends FunSpec with Matchers {
2660
2660
2661
2661
// Then should come one-element Lists of the canonicals of the type
2662
2662
val phase2 = shrinks.drop(1 ).take(intCanonicals.length)
2663
- phase2 shouldEqual (intCanonicals.map(i => factory(i)))
2663
+ phase2 shouldEqual (intCanonicals.map(i => ColCompatHelper .newBuilder( factory). += (i).result ))
2664
2664
2665
2665
// Phase 3 should be one-element lists of all distinct values in the value passed to shrink
2666
2666
// If xs already is a one-element list, then we don't do this, because then xs would appear in the output.
2667
2667
val xsList = xs.toList
2668
2668
val xsDistincts = if (xsList.length > 1 ) xsList.distinct else Nil
2669
2669
val phase3 = shrinks.drop(1 + intCanonicals.length).take(xsDistincts.length)
2670
- phase3 shouldEqual (xsDistincts.map(i => factory(i)))
2670
+ phase3 shouldEqual (xsDistincts.map(i => ColCompatHelper .newBuilder( factory). += (i).result ))
2671
2671
2672
2672
// Phase 4 should be n-element lists that are prefixes cut in half
2673
2673
val theHalves = shrinks.drop(1 + intCanonicals.length + xsDistincts.length)
@@ -2683,6 +2683,8 @@ class GeneratorSpec extends FunSpec with Matchers {
2683
2683
}
2684
2684
}
2685
2685
2686
+ import org .scalactic .ColCompatHelper .Factory ._
2687
+
2686
2688
describe(" for Lists" ) {
2687
2689
it(" should offer a List[T] generator that returns a List[T] whose length equals the passed size" ) {
2688
2690
0 commit comments