Open
Description
Kotlin version 1.8.20
Simple class defined in a file called simple.kts
class Test {
val x = 5
}
Testing the Script Engine Manager using the following:
@test
fun testClassCompile() {
val scriptReader = this::class.java.classLoader.getResource("simple.kts").openStream().reader()
val engine = ScriptEngineManager().getEngineByExtension("kts")
try {
val result = engine.eval(scriptReader)
assertNotNull(result)
}catch (se: ScriptException) {
fail()
}
}
If I am not mistaken this test should be returning an Object of type Class and not null. Please correct me if I am incorrect or have misunderstood how to get the Class object back.
Metadata
Metadata
Assignees
Labels
No labels