Add additional test to make sure Future.flow does not block on long running Futures
This commit is contained in:
parent
120f12d739
commit
eecfea5c5e
1 changed files with 20 additions and 0 deletions
|
|
@ -440,4 +440,24 @@ class FutureSpec extends JUnitSuite {
|
|||
assert(lz.isOpen)
|
||||
assert(result.get === 10)
|
||||
}
|
||||
|
||||
@Test def futureContinuationsShouldNotBlock {
|
||||
import Future.flow
|
||||
|
||||
val latch = new StandardLatch
|
||||
val future = Future {
|
||||
latch.await
|
||||
"Hello"
|
||||
}
|
||||
|
||||
val result = flow {
|
||||
Some(future()).filter(_ == "Hello")
|
||||
}
|
||||
|
||||
assert(!result.isCompleted)
|
||||
|
||||
latch.open
|
||||
|
||||
assert(result.get === Some("Hello"))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue