Skip to content

Commit a7b4ec0

Browse files
tests: Clean up failing tests in scala3
1 parent 9e09362 commit a7b4ec0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

core/src/test/scala/iterable.scala

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package dispatch.spec
22

33
import org.scalacheck._
4+
import scala.collection.immutable.ArraySeq
45

56
object IterableFutureSpecification
67
extends Properties("Iterable Future")
78
with DispatchCleanup {
8-
import Prop.{forAll,AnyOperators}
9-
import Gen._
9+
import Prop.{forAll}
1010

1111
private val port = unfiltered.util.Port.any
1212
val server = {
@@ -31,7 +31,7 @@ with DispatchCleanup {
3131

3232
def split(str: String): Future[Seq[String]] =
3333
for (csv <- Http.default(localhost / "split" << Seq("str" -> str) > as.String))
34-
yield csv.split(",")
34+
yield ArraySeq.unsafeWrapArray(csv.split(","))
3535

3636
def value(str: String): Future[Int] =
3737
for (v <- Http.default(localhost / "value" << Seq("chr" -> str) > as.String))
@@ -42,7 +42,8 @@ with DispatchCleanup {
4242
val values = split(sample).values.flatMap { chr =>
4343
value(chr)
4444
}
45-
values() ?= sample.map { _.toInt }
45+
46+
Prop.?=(values(), sample.map(_.toInt))
4647
}
4748

4849
property("iterable future values") = forAll(Gen.alphaStr) {
@@ -55,10 +56,12 @@ with DispatchCleanup {
5556
c2 <- value(chr2)
5657
} yield (c1, c2)
5758

58-
values() ?= (for {
59+
val expected: Iterable[(Int, Int)] = for {
5960
c1 <- sample
6061
c2 <- sample.reverse
61-
} yield (c1.toInt, c2.toInt))
62+
} yield (c1.toInt, c2.toInt)
63+
64+
Prop.?=(values(), expected)
6265
}
6366

6467
property("iterable future values on either") = forAll(Gen.alphaStr) {
@@ -68,9 +71,12 @@ with DispatchCleanup {
6871
chr1 <- split(sample).either.right.values
6972
c1 <- value(chr1)
7073
} yield Right(c1)
71-
values().toOption.get ?= (for {
74+
75+
val expected = (for {
7276
c1 <- sample
7377
} yield c1.toInt)
78+
79+
Prop.?=(values(), Right(expected))
7480
}
7581

7682
}

0 commit comments

Comments
 (0)