Christophe Dongieux
withTimeout
@ExperimentalCoroutinesApi @Test fun withTimeout() = runTest { val result = withTimeout(1_000L) { try{ runInterruptible { Thread.sleep(2_000L) Result.success(42) } } catch (e: Exception) { Result.failure(e) } } assert(result.isFailure) // Assertion failed }
A modern programming language that makes developers happier.