-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathFailingTests.kt
37 lines (31 loc) · 1007 Bytes
/
FailingTests.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package kotlinx.coroutines.test
import kotlinx.coroutines.*
import kotlinx.coroutines.test.internal.*
import kotlin.test.*
/** These are tests that we want to fail. They are here so that, when the issue is fixed, their failure indicates that
* everything is better now. */
class FailingTests {
private var tearDownEntered = false
@BeforeTest
fun setUp() {
Dispatchers.setMain(StandardTestDispatcher())
}
@AfterTest
fun tearDown() {
Dispatchers.resetMain()
tearDownEntered = true
}
/** [TestDispatchersTest.testMainMocking]. */
@Test
fun testAfterTestIsConcurrent() = runTest {
try {
val mainAtStart = TestMainDispatcher.currentTestDispatcher ?: return@runTest
withContext(Dispatchers.Default) {
// context switch
}
assertNotSame(mainAtStart, TestMainDispatcher.currentTestDispatcher!!)
} finally {
assertTrue(tearDownEntered)
}
}
}