Make assertions worker-friendly. (#2152)
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user