Fix tests in the new build infrastructure
This commit is contained in:
+39
-34
@@ -9,34 +9,55 @@ jvmTarget = "1.6"
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
val otherCompilerModules = compilerModules.filter { it != path }
|
||||
|
||||
val depDistProjects = listOf(
|
||||
":kotlin-script-runtime",
|
||||
":kotlin-stdlib",
|
||||
":kotlin-reflect",
|
||||
":kotlin-test:kotlin-test-jvm")
|
||||
|
||||
// TODO: it seems incomplete, find and add missing dependencies
|
||||
val testDistProjects = listOf(
|
||||
"", // for root project
|
||||
":prepare:mock-runtime-for-test",
|
||||
":kotlin-compiler",
|
||||
":kotlin-runtime",
|
||||
":kotlin-script-runtime",
|
||||
":kotlin-stdlib",
|
||||
":kotlin-stdlib-jre7",
|
||||
":kotlin-stdlib-jre8",
|
||||
":kotlin-stdlib-js",
|
||||
":kotlin-reflect",
|
||||
":kotlin-test:kotlin-test-jvm",
|
||||
":kotlin-test:kotlin-test-junit",
|
||||
":kotlin-test:kotlin-test-js",
|
||||
":kotlin-daemon-client",
|
||||
":android-extensions-compiler",
|
||||
":kotlin-ant")
|
||||
|
||||
dependencies {
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-junit"))
|
||||
testCompile(project(":compiler.tests-common"))
|
||||
testCompileOnly(project(":compiler:ir.ir2cfg"))
|
||||
testCompileOnly(project(":compiler:ir.tree")) // used for deepCopyWithSymbols call that is removed by proguard from the compiler TODO: make it more straightforward
|
||||
testCompile(ideaSdkDeps("openapi", "idea", "util", "asm-all", "commons-httpclient-3.1-patched"))
|
||||
// deps below are test runtime deps, but made test compile to split compilation and running to reduce mem req
|
||||
testCompile(project(":kotlin-stdlib"))
|
||||
testCompile(project(":kotlin-script-runtime"))
|
||||
testCompile(project(":kotlin-runtime"))
|
||||
testCompile(project(":kotlin-reflect"))
|
||||
testCompile(project(":android-extensions-compiler"))
|
||||
testCompile(project(":kotlin-ant"))
|
||||
otherCompilerModules.forEach {
|
||||
testCompile(project(it))
|
||||
depDistProjects.forEach {
|
||||
testCompile(projectDist(it))
|
||||
}
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompileOnly(projectDist(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompileOnly(projectDist(":kotlin-test:kotlin-test-junit"))
|
||||
testCompile(project(":compiler.tests-common"))
|
||||
testCompile(project(":compiler:ir.ir2cfg"))
|
||||
testCompile(project(":compiler:ir.tree")) // used for deepCopyWithSymbols call that is removed by proguard from the compiler TODO: make it more straightforward
|
||||
otherCompilerModules.forEach {
|
||||
testCompileOnly(project(it))
|
||||
}
|
||||
testCompile(ideaSdkDeps("openapi", "idea", "util", "asm-all", "commons-httpclient-3.1-patched"))
|
||||
testRuntime(ideaSdkCoreDeps("*.jar"))
|
||||
testRuntime(ideaSdkDeps("*.jar"))
|
||||
// testRuntime(project(":kotlin-compiler", configuration = "default"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" {}
|
||||
"test" {
|
||||
projectDefault()
|
||||
java.srcDir("tests-ir-jvm/tests")
|
||||
// not yet ready
|
||||
// java.srcDir("tests-ir-jvm/tests")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,22 +73,6 @@ jar.apply {
|
||||
|
||||
testsJar {}
|
||||
|
||||
// TODO: it seems incomlete, find and add missing dependencies
|
||||
val testDistProjects = listOf(
|
||||
":prepare:mock-runtime-for-test",
|
||||
":kotlin-compiler",
|
||||
":kotlin-runtime",
|
||||
":kotlin-script-runtime",
|
||||
":kotlin-stdlib",
|
||||
":kotlin-stdlib-jre7",
|
||||
":kotlin-stdlib-jre8",
|
||||
":kotlin-stdlib-js",
|
||||
":kotlin-reflect",
|
||||
":kotlin-test:kotlin-test-jvm",
|
||||
":kotlin-test:kotlin-test-junit",
|
||||
":kotlin-test:kotlin-test-js",
|
||||
":kotlin-daemon-client")
|
||||
|
||||
projectTest {
|
||||
dependsOn(*testDistProjects.map { "$it:dist" }.toTypedArray())
|
||||
workingDir = rootDir
|
||||
|
||||
@@ -6,7 +6,7 @@ apply { plugin("kotlin") }
|
||||
jvmTarget = "1.6"
|
||||
|
||||
dependencies {
|
||||
compile(project(":kotlin-stdlib"))
|
||||
compile(projectDist(":kotlin-stdlib"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -7,8 +7,9 @@ dependencies {
|
||||
compile(project(":core:util.runtime"))
|
||||
compile(commonDep("javax.inject"))
|
||||
compile(ideaSdkCoreDeps("intellij-core"))
|
||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(projectDist(":kotlin-test:kotlin-test-junit"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
||||
testRuntime(ideaSdkCoreDeps("trove4j", "intellij-core"))
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ jvmTarget = "1.6"
|
||||
dependencies {
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":kotlin-reflect"))
|
||||
compile(projectDist(":kotlin-reflect"))
|
||||
compile(preloadedDeps("kotlinx-coroutines-core"))
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ dependencies {
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:container"))
|
||||
compile(project(":compiler:resolution"))
|
||||
compile(project(":kotlin-script-runtime"))
|
||||
compile(projectDist(":kotlin-script-runtime"))
|
||||
compile(commonDep("io.javaslang","javaslang"))
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,9 @@ dependencies {
|
||||
compile(project(":compiler:frontend.java"))
|
||||
compile(project(":compiler:cli"))
|
||||
compile(project(":kotlin-build-common"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-junit"))
|
||||
testCompile(project(":kotlin-stdlib"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(projectDist(":kotlin-test:kotlin-test-junit"))
|
||||
testCompile(projectDist(":kotlin-stdlib"))
|
||||
testCompile(projectTests(":kotlin-build-common"))
|
||||
}
|
||||
|
||||
|
||||
@@ -344,9 +344,9 @@ public class KotlinTestUtils {
|
||||
|
||||
@NotNull
|
||||
public static String getHomeDirectory() {
|
||||
File resourceRoot = PathUtil.getResourcePathForClass(KotlinTestUtils.class);
|
||||
// TODO: very fragile logic, consider more robust home dir detection
|
||||
return FileUtil.toSystemIndependentName(resourceRoot.getParentFile().getParentFile().getParentFile().getParent());
|
||||
String userDir = System.getProperty("user.dir");
|
||||
File dir = new File(userDir == null ? "." : userDir);
|
||||
return FileUtil.toCanonicalPath(dir.getAbsolutePath());
|
||||
}
|
||||
|
||||
public static File findMockJdkRtJar() {
|
||||
|
||||
@@ -4,8 +4,8 @@ apply { plugin("kotlin") }
|
||||
|
||||
dependencies {
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-junit"))
|
||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(projectDist(":kotlin-test:kotlin-test-junit"))
|
||||
testCompile(project(":compiler.tests-common"))
|
||||
testCompile(project(":core"))
|
||||
testCompile(project(":compiler:util"))
|
||||
@@ -16,12 +16,12 @@ dependencies {
|
||||
testCompile(project(":compiler:serialization"))
|
||||
testCompile(ideaSdkDeps("openapi", "idea", "util", "asm-all"))
|
||||
// deps below are test runtime deps, but made test compile to split compilation and running to reduce mem req
|
||||
testCompile(project(":kotlin-stdlib"))
|
||||
testCompile(project(":kotlin-script-runtime"))
|
||||
testCompile(project(":kotlin-runtime"))
|
||||
testCompile(project(":kotlin-reflect"))
|
||||
testCompile(projectDist(":kotlin-stdlib"))
|
||||
testCompile(projectDist(":kotlin-script-runtime"))
|
||||
testCompile(projectDist(":kotlin-runtime"))
|
||||
testCompile(projectDist(":kotlin-reflect"))
|
||||
testCompile(projectTests(":compiler"))
|
||||
testRuntime(project(":kotlin-preloader"))
|
||||
testRuntime(projectDist(":kotlin-preloader"))
|
||||
testRuntime(ideaSdkCoreDeps("*.jar"))
|
||||
testRuntime(ideaSdkDeps("*.jar"))
|
||||
}
|
||||
|
||||
@@ -206,6 +206,10 @@ class TestMessageCollector : MessageCollector {
|
||||
}
|
||||
|
||||
override fun hasErrors(): Boolean = messages.any { it.severity == CompilerMessageSeverity.EXCEPTION || it.severity == CompilerMessageSeverity.ERROR }
|
||||
|
||||
override fun toString(): String {
|
||||
return messages.joinToString("\n") { "${it.severity}: ${it.message}${it.location?.let{" at $it"} ?: ""}" }
|
||||
}
|
||||
}
|
||||
|
||||
fun TestMessageCollector.assertHasMessage(msg: String, desiredSeverity: CompilerMessageSeverity? = null) {
|
||||
|
||||
@@ -61,8 +61,9 @@ import kotlin.script.templates.standard.ScriptTemplateWithArgs
|
||||
class ScriptTemplateTest {
|
||||
@Test
|
||||
fun testScriptWithParam() {
|
||||
val aClass = compileScript("fib.kts", ScriptWithIntParam::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib.kts", ScriptWithIntParam::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}
|
||||
@@ -71,8 +72,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithClassParameter() {
|
||||
val aClass = compileScript("fib_cp.kts", ScriptWithClassParam::class, null, runIsolated = false)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib_cp.kts", ScriptWithClassParam::class, null, runIsolated = false, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(TestParamClass::class.java).newInstance(TestParamClass(4))
|
||||
}
|
||||
@@ -81,8 +83,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithBaseClassWithParam() {
|
||||
val aClass = compileScript("fib_dsl.kts", ScriptWithBaseClass::class, null, runIsolated = false)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib_dsl.kts", ScriptWithBaseClass::class, null, runIsolated = false, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE, Integer.TYPE).newInstance(4, 1)
|
||||
}
|
||||
@@ -93,8 +96,9 @@ class ScriptTemplateTest {
|
||||
fun testScriptWithDependsAnn() {
|
||||
Assert.assertNull(compileScript("fib_ext_ann.kts", ScriptWithIntParamAndDummyResolver::class, null, includeKotlinRuntime = false))
|
||||
|
||||
val aClass = compileScript("fib_ext_ann.kts", ScriptWithIntParam::class, null, includeKotlinRuntime = false)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib_ext_ann.kts", ScriptWithIntParam::class, null, includeKotlinRuntime = false, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}
|
||||
@@ -112,8 +116,9 @@ class ScriptTemplateTest {
|
||||
System.setErr(savedErr)
|
||||
}
|
||||
|
||||
val aClass = compileScript("fib_ext_ann2.kts", ScriptWithIntParam::class, null, includeKotlinRuntime = false)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib_ext_ann2.kts", ScriptWithIntParam::class, null, includeKotlinRuntime = false, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}
|
||||
@@ -122,8 +127,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithoutParams() {
|
||||
val aClass = compileScript("without_params.kts", ScriptWithoutParams::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("without_params.kts", ScriptWithoutParams::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}
|
||||
@@ -132,8 +138,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithOverriddenParam() {
|
||||
val aClass = compileScript("overridden_parameter.kts", ScriptBaseClassWithOverriddenProperty::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("overridden_parameter.kts", ScriptBaseClassWithOverriddenProperty::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}
|
||||
@@ -142,8 +149,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithArrayParam() {
|
||||
val aClass = compileScript("array_parameter.kts", ScriptWithArrayParam::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("array_parameter.kts", ScriptWithArrayParam::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Array<String>::class.java).newInstance(arrayOf("one", "two"))
|
||||
}.let {
|
||||
@@ -153,8 +161,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithNullableParam() {
|
||||
val aClass = compileScript("nullable_parameter.kts", ScriptWithNullableParam::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("nullable_parameter.kts", ScriptWithNullableParam::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Int::class.javaObjectType).newInstance(null)
|
||||
}.let {
|
||||
@@ -164,8 +173,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptVarianceParams() {
|
||||
val aClass = compileScript("variance_parameters.kts", ScriptVarianceParams::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("variance_parameters.kts", ScriptVarianceParams::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Array<in Number>::class.java, Array<out Number>::class.java).newInstance(arrayOf("one"), arrayOf(1, 2))
|
||||
}.let {
|
||||
@@ -175,8 +185,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithNullableProjection() {
|
||||
val aClass = compileScript("nullable_projection.kts", ScriptWithNullableProjection::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("nullable_projection.kts", ScriptWithNullableProjection::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Array<String>::class.java).newInstance(arrayOf<String?>(null))
|
||||
}.let {
|
||||
@@ -186,8 +197,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithArray2DParam() {
|
||||
val aClass = compileScript("array2d_param.kts", ScriptWithArray2DParam::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("array2d_param.kts", ScriptWithArray2DParam::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Array<Array<in String>>::class.java).newInstance(arrayOf(arrayOf("one"), arrayOf("two")))
|
||||
}.let {
|
||||
@@ -197,8 +209,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithStandardTemplate() {
|
||||
val aClass = compileScript("fib_std.kts", ScriptTemplateWithArgs::class, runIsolated = false)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib_std.kts", ScriptTemplateWithArgs::class, runIsolated = false, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Array<String>::class.java).newInstance(arrayOf("4", "other"))
|
||||
}.let {
|
||||
@@ -208,8 +221,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithPackage() {
|
||||
val aClass = compileScript("fib.pkg.kts", ScriptWithIntParam::class)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib.pkg.kts", ScriptWithIntParam::class, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}.let {
|
||||
@@ -219,8 +233,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithScriptDefinition() {
|
||||
val aClass = compileScript("fib.kts", ScriptWithIntParam::class)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib.kts", ScriptWithIntParam::class, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}.let {
|
||||
@@ -230,8 +245,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testScriptWithParamConversion() {
|
||||
val aClass = compileScript("fib.kts", ScriptWithIntParam::class)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib.kts", ScriptWithIntParam::class, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
captureOut {
|
||||
val anObj = tryConstructClassFromStringArgs(aClass!!, listOf("4"))
|
||||
Assert.assertNotNull(anObj)
|
||||
@@ -253,8 +269,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testAsyncResolver() {
|
||||
val aClass = compileScript("fib.kts", ScriptWithAsyncResolver::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib.kts", ScriptWithAsyncResolver::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
val out = captureOut {
|
||||
aClass!!.getConstructor(Integer.TYPE).newInstance(4)
|
||||
}
|
||||
@@ -263,32 +280,37 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testAcceptedAnnotationsSync() {
|
||||
val aClass = compileScript("acceptedAnnotations.kts", ScriptWithAcceptedAnnotationsSyncResolver::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("acceptedAnnotations.kts", ScriptWithAcceptedAnnotationsSyncResolver::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAcceptedAnnotationsAsync() {
|
||||
val aClass = compileScript("acceptedAnnotations.kts", ScriptWithAcceptedAnnotationsAsyncResolver::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("acceptedAnnotations.kts", ScriptWithAcceptedAnnotationsAsyncResolver::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAcceptedAnnotationsLegacy() {
|
||||
val aClass = compileScript("acceptedAnnotations.kts", ScriptWithAcceptedAnnotationsLegacyResolver::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("acceptedAnnotations.kts", ScriptWithAcceptedAnnotationsLegacyResolver::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSeveralConstructors() {
|
||||
val aClass = compileScript("fib.kts", ScriptWithSeveralConstructorsResolver::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib.kts", ScriptWithSeveralConstructorsResolver::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testConstructorWithDefaultArgs() {
|
||||
val aClass = compileScript("fib.kts", ScriptWithDefaultArgsResolver::class, null)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("fib.kts", ScriptWithDefaultArgsResolver::class, null, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -301,8 +323,9 @@ class ScriptTemplateTest {
|
||||
|
||||
@Test
|
||||
fun testSmokeScriptException() {
|
||||
val aClass = compileScript("smoke_exception.kts", ScriptWithArrayParam::class)
|
||||
Assert.assertNotNull(aClass)
|
||||
val messageCollector = TestMessageCollector()
|
||||
val aClass = compileScript("smoke_exception.kts", ScriptWithArrayParam::class, messageCollector = messageCollector)
|
||||
Assert.assertNotNull("Compilation failed:\n$messageCollector", aClass)
|
||||
var exceptionThrown = false
|
||||
try {
|
||||
tryConstructClassFromStringArgs(aClass!!, emptyList())
|
||||
@@ -349,7 +372,12 @@ class ScriptTemplateTest {
|
||||
): Class<*>? {
|
||||
val rootDisposable = Disposer.newDisposable()
|
||||
try {
|
||||
val configuration = KotlinTestUtils.newConfiguration(if (includeKotlinRuntime) ConfigurationKind.ALL else ConfigurationKind.JDK_ONLY, TestJdkKind.FULL_JDK)
|
||||
val additionalClasspath = System.getProperty("kotlin.test.script.classpath")?.split(File.pathSeparator)
|
||||
?.map{ File(it) }.orEmpty().toTypedArray()
|
||||
val configuration = KotlinTestUtils.newConfiguration(
|
||||
if (includeKotlinRuntime) ConfigurationKind.ALL else ConfigurationKind.JDK_ONLY,
|
||||
TestJdkKind.FULL_JDK,
|
||||
*additionalClasspath)
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
|
||||
configuration.addKotlinSourceRoot(scriptPath)
|
||||
configuration.add(JVMConfigurationKeys.SCRIPT_DEFINITIONS, scriptDefinition)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
jvmTarget = "1.6"
|
||||
|
||||
dependencies {
|
||||
compile(project(":core"))
|
||||
compile(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
|
||||
|
||||
Reference in New Issue
Block a user