Create standard script definition from standard template
Now each script without specified template has a StandardSriptTemplate class as a base one. This allows to generalize script codegen and resolve.
This commit is contained in:
@@ -37,6 +37,7 @@ import java.lang.Exception
|
||||
import java.net.URLClassLoader
|
||||
import java.util.concurrent.Future
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.script.StandardScriptTemplate
|
||||
|
||||
// TODO: the contetnts of this file should go into ScriptTest.kt and replace appropriate xml-based functionality,
|
||||
// as soon as the the latter is removed from the codebase
|
||||
@@ -126,6 +127,13 @@ class ScriptTest2 {
|
||||
aClass!!.getConstructor(Array<Array<in String>>::class.java).newInstance(arrayOf(arrayOf("one"), arrayOf("two")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testScriptWithStandardTemplate() {
|
||||
val aClass = compileScript("fib_std.kts", StandardScriptTemplate::class, runIsolated = false)
|
||||
Assert.assertNotNull(aClass)
|
||||
aClass!!.getConstructor(Array<String>::class.java).newInstance(arrayOf("4", "other"))
|
||||
}
|
||||
|
||||
private fun compileScript(
|
||||
scriptPath: String,
|
||||
scriptBase: KClass<out Any>,
|
||||
|
||||
Reference in New Issue
Block a user