Restore returning of functional types from repl eval
add tests for the broken case as well for the return value representation #KT-29490 fixed
This commit is contained in:
+11
@@ -233,6 +233,17 @@ obj
|
||||
Assert.assertTrue("eval in eval is too long: ${times.joinToString { "(${it.first.ms()}, ${it.second.ms()})" }} (expecting no more than 5x difference)",
|
||||
adjustedMaxDiff.third < 20 /* assuming it measurement error */ || adjustedMaxDiff.first * 5 > adjustedMaxDiff.second )
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `kotlin script evaluation should support functional return types`() {
|
||||
val scriptEngine = KotlinJsr223JvmLocalScriptEngineFactory().scriptEngine
|
||||
|
||||
val script = "{1 + 2}"
|
||||
val result = scriptEngine.eval(script)
|
||||
|
||||
Assert.assertTrue(result is Function0<*>)
|
||||
Assert.assertEquals(3, (result as Function0<*>).invoke())
|
||||
}
|
||||
}
|
||||
|
||||
fun assertThrows(exceptionClass: Class<*>, body: () -> Unit) {
|
||||
|
||||
Reference in New Issue
Block a user