Skip to content

Commit

Permalink
Fix #24
Browse files Browse the repository at this point in the history
It turned out that the problem is no longer actual. doEval("1") call was deleted, test was added.
  • Loading branch information
ileasile committed Jun 25, 2020
1 parent 0bb8f32 commit b5f9436
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/main/kotlin/org/jetbrains/kotlin/jupyter/repl.kt
Expand Up @@ -275,11 +275,6 @@ class ReplForJupyterImpl(val scriptClasspath: List<File> = emptyList(),
}
}

init {
// TODO: to be removed after investigation of https://github.com/kotlin/kotlin-jupyter/issues/24
doEval("1")
}

private fun executeInitCellCode() = initCellCodes.forEach(::evalNoReturn)

private fun executeInitCode(p: PreprocessingResult) = p.initCodes.forEach(::evalNoReturn)
Expand Down
14 changes: 13 additions & 1 deletion src/test/kotlin/org/jetbrains/kotlin/jupyter/test/replTests.kt
Expand Up @@ -65,7 +65,7 @@ class ReplTest {
val message = ex.message

val expectedLocation = SourceCode.Location(SourceCode.Position(3, 11), SourceCode.Position(3, 14))
val expectedMessage = "Line_1.jupyter.kts (3:11 - 14) Unresolved reference: ppp"
val expectedMessage = "Line_0.jupyter.kts (3:11 - 14) Unresolved reference: ppp"

assertEquals(expectedLocation, location)
assertEquals(expectedMessage, message)
Expand Down Expand Up @@ -110,6 +110,18 @@ class ReplTest {
}
}

@Test
fun testExternalStaticFunctions() {
val repl = ReplForJupyterImpl(classpath)
val res = repl.eval("""
@file:DependsOn("src/test/testData/kernelTestPackage-1.0.jar")
import pack.*
func()
""".trimIndent())

assertEquals(42, res.resultValue)
}

@Test
fun testScriptIsolation() {
val repl = ReplForJupyterImpl(classpath)
Expand Down
Binary file added src/test/testData/kernelTestPackage-1.0.jar
Binary file not shown.

0 comments on commit b5f9436

Please sign in to comment.