File tree 2 files changed +13
-2
lines changed
main/kotlin/org/jetbrains/kotlin/jupyter
test/kotlin/org/jetbrains/kotlin/jupyter/test
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ class JupyterConnection(val config: KernelConfig): Closeable {
95
95
currentBuf = null
96
96
return - 1
97
97
}
98
- currentBufPos.inc()
99
- return buf[currentBufPos - 1 ].toInt()
98
+
99
+ return buf[currentBufPos++ ].toInt()
100
100
}
101
101
102
102
@Synchronized
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import org.jetbrains.kotlin.jupyter.*
5
5
import org.junit.Assert
6
6
import org.junit.Test
7
7
import org.zeromq.ZMQ
8
+ import kotlin.test.assertEquals
8
9
9
10
fun Message.type (): String {
10
11
return header!! [" msg_type" ] as String
@@ -132,4 +133,14 @@ class ExecuteTests : KernelServerTestsBase() {
132
133
val res = doExecute(code, false , ::checker)
133
134
Assert .assertNull(res)
134
135
}
136
+
137
+ @Test
138
+ fun testReadLine () {
139
+ val code = """
140
+ val answer = readLine()
141
+ answer
142
+ """ .trimIndent()
143
+ val res = doExecute(code, inputs = listOf (" 42" ))
144
+ assertEquals(jsonObject(" text/plain" to " 42" ), res)
145
+ }
135
146
}
You can’t perform that action at this time.
0 commit comments