aboutsummaryrefslogtreecommitdiff
path: root/kotlinx-coroutines-test/jvm/test/HelpersJvm.kt
blob: 8d40b078a305d88c7b00cfab481fd4eb3e70abb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */
package kotlinx.coroutines.test

actual fun testResultChain(block: () -> TestResult, after: (Result<Unit>) -> TestResult): TestResult {
    try {
        block()
        after(Result.success(Unit))
    } catch (e: Throwable) {
        after(Result.failure(e))
    }
}