blob: 713cc2f65104f9921d5fbb2728e9fb00095b5e55 [file] [log] [blame]
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03001/*
2 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
4
Vsevolod Tolstopyatov96191342018-04-20 18:13:33 +03005package kotlinx.coroutines.experimental.channels
6
7import kotlinx.coroutines.experimental.*
8import org.junit.Test
9import kotlin.test.*
10
11class ChannelsJvmTest : TestBase() {
12
13 @Test
14 fun testBlocking() {
15 val ch = Channel<Int>()
16 val sum = async {
17 ch.sumBy { it }
18 }
19 repeat(10) {
20 ch.sendBlocking(it)
21 }
22 ch.close()
23 assertEquals(45, runBlocking { sum.await() })
24 }
25}