55package kotlinx.coroutines.experimental.channels
66
77import kotlinx.coroutines.experimental.*
8+ import kotlin.coroutines.experimental.*
89import kotlin.math.*
910import kotlin.test.*
1011
@@ -132,7 +133,7 @@ class ChannelsTest: TestBase() {
132133
133134 @Test
134135 fun testMapToSendChannel () = runTest {
135- val c = produce<Int > {
136+ val c = produce<Int >(coroutineContext) {
136137 testList.asReceiveChannel().mapTo(channel) { it + 10 }
137138 }
138139 assertEquals(testList.map { it + 10 }, c.toList())
@@ -327,7 +328,7 @@ class ChannelsTest: TestBase() {
327328 @Test
328329 fun testFilterToSendChannel () = runTest {
329330 repeat(3 ) { mod ->
330- val c = produce<Int > {
331+ val c = produce<Int >(coroutineContext) {
331332 testList.asReceiveChannel().filterTo(channel) { it % 2 == mod }
332333 }
333334 assertEquals(testList.filter { it % 2 == mod }, c.toList())
@@ -354,7 +355,7 @@ class ChannelsTest: TestBase() {
354355 @Test
355356 fun testFilterNotToSendChannel () = runTest {
356357 repeat(3 ) { mod ->
357- val c = produce<Int > {
358+ val c = produce<Int >(coroutineContext) {
358359 testList.asReceiveChannel().filterNotTo(channel) { it % 2 == mod }
359360 }
360361 assertEquals(testList.filterNot { it % 2 == mod }, c.toList())
@@ -381,7 +382,7 @@ class ChannelsTest: TestBase() {
381382 @Test
382383 fun testFilterNotNullToSendChannel () = runTest {
383384 repeat(3 ) { mod ->
384- val c = produce<Int > {
385+ val c = produce<Int >(coroutineContext) {
385386 testList.asReceiveChannel().map { it.takeIf { it % 2 == mod } }.filterNotNullTo(channel)
386387 }
387388 assertEquals(testList.map { it.takeIf { it % 2 == mod } }.filterNotNull(), c.toList())
@@ -408,7 +409,7 @@ class ChannelsTest: TestBase() {
408409 @Test
409410 fun testFilterIndexedToChannel () = runTest {
410411 repeat(3 ) { mod ->
411- val c = produce<Int > {
412+ val c = produce<Int >(coroutineContext) {
412413 testList.asReceiveChannel().filterIndexedTo(channel) { index, _ -> index % 2 == mod }
413414 }
414415 assertEquals(testList.filterIndexed { index, _ -> index % 2 == mod }, c.toList())
@@ -425,7 +426,7 @@ class ChannelsTest: TestBase() {
425426
426427 @Test
427428 fun testToChannel () = runTest {
428- val c = produce<Int > {
429+ val c = produce<Int >(coroutineContext) {
429430 testList.asReceiveChannel().toChannel(channel)
430431 }
431432 assertEquals(testList, c.toList())
@@ -446,7 +447,7 @@ class ChannelsTest: TestBase() {
446447
447448 @Test
448449 fun testMapIndexedToSendChannel () = runTest {
449- val c = produce<Int > {
450+ val c = produce<Int >(coroutineContext) {
450451 testList.asReceiveChannel().mapIndexedTo(channel) { index, i -> index + i }
451452 }
452453 assertEquals(testList.mapIndexed { index, i -> index + i }, c.toList())
@@ -472,7 +473,7 @@ class ChannelsTest: TestBase() {
472473 @Test
473474 fun testMapNotNullToSendChannel () = runTest {
474475 repeat(3 ) { mod ->
475- val c = produce<Int > {
476+ val c = produce<Int >(coroutineContext) {
476477 testList.asReceiveChannel().mapNotNullTo(channel) { i -> i.takeIf { i % 2 == mod } }
477478 }
478479 assertEquals(testList.mapNotNull { i -> i.takeIf { i % 2 == mod } }, c.toList())
@@ -499,7 +500,7 @@ class ChannelsTest: TestBase() {
499500 @Test
500501 fun testMapIndexedNotNullToSendChannel () = runTest {
501502 repeat(3 ) { mod ->
502- val c = produce<Int > {
503+ val c = produce<Int >(coroutineContext) {
503504 testList.asReceiveChannel().mapIndexedNotNullTo(channel) { index, i -> index.takeIf { i % 2 == mod } }
504505 }
505506 assertEquals(testList.mapIndexedNotNull { index, i -> index.takeIf { i % 2 == mod } }, c.toList())
0 commit comments