Refactor JSR223 to support Compilable interface, drop daemon eval engine and sample, simplify

This commit is contained in:
Ilya Chernikov
2016-12-06 19:14:05 +01:00
parent b19d61e2f4
commit cb7f22ffec
13 changed files with 227 additions and 451 deletions
@@ -38,14 +38,13 @@ import org.jetbrains.kotlin.utils.PathUtil
import org.jetbrains.kotlin.utils.PathUtil.getResourcePathForClass
import org.junit.Assert
import org.junit.Test
import java.io.ByteArrayOutputStream
import java.io.File
import java.io.PrintStream
import java.io.*
import java.net.URI
import java.util.jar.Manifest
import kotlin.reflect.KClass
import kotlin.test.*
class ScriptUtilIT {
companion object {
@@ -89,7 +88,14 @@ done
@Test
fun testResolveStdJUnitHelloWorld() {
Assert.assertNull(compileScript("args-junit-hello-world.kts", StandardArgsScriptTemplateWithLocalResolving::class))
val savedErr = System.err
try {
System.setErr(PrintStream(NullOutputStream()))
Assert.assertNull(compileScript("args-junit-hello-world.kts", StandardArgsScriptTemplateWithLocalResolving::class))
}
finally {
System.setErr(savedErr)
}
val scriptClass = compileScript("args-junit-hello-world.kts", StandardArgsScriptTemplateWithMavenResolving::class)
if (scriptClass == null) {
@@ -196,3 +202,9 @@ done
return outStream.toString()
}
}
private class NullOutputStream : OutputStream() {
override fun write(b: Int) { }
override fun write(b: ByteArray) { }
override fun write(b: ByteArray, off: Int, len: Int) { }
}