File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
kotlinx-coroutines-core/src/test/kotlin/kotlinx/coroutines/experimental Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -122,20 +122,26 @@ class WithTimeoutOrNullTest : TestBase() {
122
122
}
123
123
124
124
@Test
125
- fun testOuterTimeoutTest () = runBlocking {
126
- var counter = 0
127
- val result = withTimeoutOrNull(250 ) {
128
- while (true ) {
129
- val inner = withTimeoutOrNull(100 ) {
125
+ fun testOuterTimeoutTest () {
126
+ // stress test this particular case 1000 times
127
+ val nTimes = if (isStressTest) 1000 else 1
128
+ repeat(nTimes) {
129
+ runBlocking {
130
+ var counter = 0
131
+ val result = withTimeoutOrNull(250 ) {
130
132
while (true ) {
131
- yield ()
133
+ val inner = withTimeoutOrNull(100 ) {
134
+ while (true ) {
135
+ yield ()
136
+ }
137
+ }
138
+ assertThat(inner, IsNull ())
139
+ counter++
132
140
}
133
141
}
134
- assertThat(inner , IsNull ())
135
- counter++
142
+ assertThat(result , IsNull ())
143
+ assertThat( counter, IsEqual ( 2 ))
136
144
}
137
145
}
138
- assertThat(result, IsNull ())
139
- assertThat(counter, IsEqual (2 ))
140
146
}
141
147
}
You can’t perform that action at this time.
0 commit comments