You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Test
fun testSimpleEval() {
val engine = ScriptEngineManager().getEngineByExtension("kts")!!
val res = engine.eval("2+4")
assertEquals(6,res)
}
@Test
fun testSimpleBinding() {
val engine = ScriptEngineManager().getEngineByExtension("kts")!!
engine.put("hello","world")
val res = engine.eval("hello")
assertEquals("world",res)
}
}
I've got
javax.script.ScriptException: Unresolved reference: hello
at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.compileAndEval(KotlinJsr223JvmScriptEngineBase.kt:65)
at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.eval(KotlinJsr223JvmScriptEngineBase.kt:31)
The text was updated successfully, but these errors were encountered:
import org.junit.Test
import javax.script.ScriptEngineManager
import kotlin.test.assertEquals
class ScriptTest {
}
I've got
javax.script.ScriptException: Unresolved reference: hello
at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.compileAndEval(KotlinJsr223JvmScriptEngineBase.kt:65)
at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.eval(KotlinJsr223JvmScriptEngineBase.kt:31)
The text was updated successfully, but these errors were encountered: