Skip to content

Commit

Permalink
fix EffApplicativeSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jul 26, 2021
1 parent 3aa2b45 commit f8dc382
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions jvm/src/test/scala/org/atnos/eff/EffApplicativeSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,22 @@ class EffApplicativeSpec(implicit ee: ExecutionEnv) extends Specification with S
def traverseAConcurrent = {
val list = (1 to 5000).toList
type S = Fx.fx2[Option, TimedFuture]
val lock = new Object
val messages: ListBuffer[Int] = new ListBuffer[Int]

val traversed: Eff[S, List[Int]] =
list.traverseA { i =>
OptionEffect.some[S, Int](i) >>
futureDelay[S, Int] { messages.append(i); i }
futureDelay[S, Int] {
lock.synchronized {
messages.append(i)
}
i
}
}

traversed.runOption.runAsync must beSome(list).awaitFor(20.seconds)

messages.size === list.size
messages.toList must not(beEqualTo(messages.toList.sorted))
}

Expand Down

0 comments on commit f8dc382

Please sign in to comment.