Fix main-kts jsr223 direct bindings processing
Before the jsr context was configured only when a dependency or import annotation is encountered, so direct properties mapping didn't work without using any of the annotations. (It was implemented like this as a workaround due to the problem with handlers composability, that was fixed some time ago.)
This commit is contained in:
+10
@@ -22,5 +22,15 @@ class MainKtsJsr223Test {
|
||||
val res2 = engine.eval("x + 2")
|
||||
Assert.assertEquals(5, res2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testWithDirectBindings() {
|
||||
val engine = ScriptEngineManager().getEngineByExtension("main.kts")!!
|
||||
engine.put("z", 6)
|
||||
val res1 = engine.eval("val x = 7")
|
||||
Assert.assertNull(res1)
|
||||
val res2 = engine.eval("z * x")
|
||||
Assert.assertEquals(42, res2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user