blob: 713cc2f65104f9921d5fbb2728e9fb00095b5e55 [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.experimental.channels
import kotlinx.coroutines.experimental.*
import org.junit.Test
import kotlin.test.*
class ChannelsJvmTest : TestBase() {
@Test
fun testBlocking() {
val ch = Channel<Int>()
val sum = async {
ch.sumBy { it }
}
repeat(10) {
ch.sendBlocking(it)
}
ch.close()
assertEquals(45, runBlocking { sum.await() })
}
}