Make assertions worker-friendly. (#2152)

This commit is contained in:
Nikolay Igotti
2018-09-28 15:31:41 +03:00
committed by GitHub
parent b9e4697893
commit 892e90cee5
4 changed files with 7 additions and 18 deletions
@@ -12,7 +12,10 @@ import kotlin.native.concurrent.*
@Test fun runTest() {
val worker = Worker.start()
val future = worker.execute(TransferMode.SAFE, { "Input" }) {
input -> input + " processed"
input ->
assertEquals(1, 1)
assertFailsWith<AssertionError> { assertEquals(1, 2) }
input + " processed"
}
future.consume {
result -> println("Got $result")
+1 -7
View File
@@ -172,11 +172,5 @@ private fun checkFailedAssertion(assertion: () -> Unit) {
@Suppress("INVISIBLE_MEMBER")
private fun withDefaultAsserter(block: () -> Unit) {
val current = overrideAsserter(DefaultAsserter)
try {
block()
}
finally {
overrideAsserter(current)
}
block()
}