blob: bed607c9ed7492944f27f2e481056009bb2307f6 [file] [log] [blame]
/*
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.coroutines.reactor
import kotlinx.coroutines.*
import org.junit.Before
import org.junit.Test
import reactor.core.scheduler.Schedulers
import kotlin.test.*
class SchedulerTest : TestBase() {
@Before
fun setup() {
ignoreLostThreads("single-")
}
@Test
fun testSingleScheduler(): Unit = runBlocking {
expect(1)
val mainThread = Thread.currentThread()
withContext(Schedulers.single().asCoroutineDispatcher()) {
val t1 = Thread.currentThread()
assertNotSame(t1, mainThread)
expect(2)
delay(100)
val t2 = Thread.currentThread()
assertNotSame(t2, mainThread)
expect(3)
}
finish(4)
}
}