Skip to content

Commit 09a0eca

Browse files
committed
added test for checking possibility to run callback after loop exit.
1 parent 079d72a commit 09a0eca

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/test/scala/gopher/channels/FlowTerminationSuite.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ class FlowTerminationSuite extends FunSuite
5252

5353
}
5454

55+
test("not propagate signals after exit") {
56+
57+
import gopherApi._
58+
val channel = makeChannel[Int](100)
59+
var sum = 0
60+
val f = select.forever{
61+
case x: channel.read => sum += x
62+
CurrentFlowTermination.exit(())
63+
//TODO: implement syntax
64+
//select.shutdown()
65+
}
66+
val f2 = channel.awrite(1)
67+
Await.result(f, 1 second)
68+
assert(sum == 1)
69+
val f3 = channel.awrite(2)
70+
Thread.sleep(1000)
71+
assert(sum == 1)
72+
73+
}
5574

5675
val gopherApi = CommonTestObjects.gopherApi
5776

0 commit comments

Comments
 (0)