+str #17418: Improved error handling for termination cases in Interpreter

This commit is contained in:
Endre Sándor Varga 2015-05-08 12:47:49 +02:00
parent ba3a69369f
commit 17733e5a54
3 changed files with 44 additions and 15 deletions

View file

@ -3,6 +3,9 @@
*/
package akka.stream.impl.fusing
import akka.stream.stage._
import scala.util.control.NoStackTrace
import akka.stream.Supervision
class InterpreterSpec extends InterpreterSpecKit {
@ -496,6 +499,25 @@ class InterpreterSpec extends InterpreterSpecKit {
lastEvents() should be(Set(OnNext("foo"), OnComplete))
}
"report error if pull is called while op is terminating" in new TestSetup(Seq(new PushPullStage[Any, Any] {
override def onPull(ctx: Context[Any]): SyncDirective = ctx.pull()
override def onPush(elem: Any, ctx: Context[Any]): SyncDirective = ctx.pull()
override def onUpstreamFinish(ctx: Context[Any]): TerminationDirective = ctx.absorbTermination()
})) {
lastEvents() should be(Set.empty)
downstream.requestOne()
lastEvents() should be(Set(RequestOne))
upstream.onComplete()
val ev = lastEvents()
ev.nonEmpty should be(true)
ev.forall {
case OnError(_: IllegalStateException) true
case _ false
} should be(true)
}
"implement expand-filter" in pending
"implement take-conflate" in pending