• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package kotlinx.coroutines
2 
3 import kotlinx.coroutines.testing.*
4 import org.junit.Test
5 import kotlin.test.*
6 
7 class IODispatcherTest : TestBase() {
8     @Test
<lambda>null9     fun testWithIOContext() = runTest {
10         // just a very basic test that is dispatcher works and indeed uses background thread
11         val mainThread = Thread.currentThread()
12         expect(1)
13         withContext(Dispatchers.IO) {
14             expect(2)
15             assertNotSame(mainThread, Thread.currentThread())
16         }
17 
18         expect(3)
19         assertSame(mainThread, Thread.currentThread())
20         finish(4)
21     }
22 }