Implement JSR223 host in the main-kts jar

also improve diagnostics on configuration instantiation
This commit is contained in:
Ilya Chernikov
2019-07-11 17:33:43 +02:00
parent 0108a76e99
commit a13d452cd8
6 changed files with 108 additions and 2 deletions
@@ -0,0 +1,26 @@
import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
import org.junit.Assert
import org.junit.Test
import javax.script.ScriptEngineManager
/*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
class MainKtsJsr223Test {
init {
setIdeaIoUseFallback()
}
@Test
fun testSimpleEval() {
val engine = ScriptEngineManager().getEngineByExtension("main.kts")!!
val res1 = engine.eval("val x = 3")
Assert.assertNull(res1)
val res2 = engine.eval("x + 2")
Assert.assertEquals(5, res2)
}
}