1 /* 2 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines 6 7 import kotlin.test.* 8 9 class WithDefaultContextTest : TestBase() { 10 @Test <lambda>null11 fun testNoSuspend() = runTest { 12 expect(1) 13 val result = withContext(Dispatchers.Default) { 14 expect(2) 15 "OK" 16 } 17 assertEquals("OK", result) 18 finish(3) 19 } 20 21 @Test <lambda>null22 fun testWithSuspend() = runTest { 23 expect(1) 24 val result = withContext(Dispatchers.Default) { 25 expect(2) 26 delay(100) 27 expect(3) 28 "OK" 29 } 30 assertEquals("OK", result) 31 finish(4) 32 } 33 }