Added a test to validate the API, it´s gorgeous

This commit is contained in:
Viktor Klang 2011-04-26 13:37:06 +02:00
parent 0b5ab21128
commit d567a08849

View file

@ -518,7 +518,7 @@ class FutureSpec extends JUnitSuite {
two << 9
assert(List(one, two).forall(_.isCompleted == true))
assert(simpleResult.await.result.get === 10)
assert(simpleResult.get === 10)
}
@ -542,17 +542,30 @@ class FutureSpec extends JUnitSuite {
y1 << 1 // When this is set, it should cascade down the line
assert(ly.tryAwaitUninterruptible(2000, TimeUnit.MILLISECONDS))
assert(x1.await.result.get === 1)
assert(x1.get === 1)
assert(!lz.isOpen)
y2 << 9 // When this is set, it should cascade down the line
assert(lz.tryAwaitUninterruptible(2000, TimeUnit.MILLISECONDS))
assert(x2.await.result.get === 9)
assert(x2.get === 9)
assert(List(x1,x2,y1,y2).forall(_.isCompleted == true))
assert(result.await.get === 10)
assert(result.get === 10)
}
@Test def dataFlowAPIshouldbeSlick {
import Future.flow
def callService1 = Future { 1 }
def callService2 = Future { 9 }
val result = flow {
callService1() + callService2()
}
assert(result.get === 10)
}
@Test def futureCompletingWithContinuationsFailure {