Implement JSR223 host in the main-kts jar
also improve diagnostics on configuration instantiation
This commit is contained in:
+26
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user