Add LightProjectDescriptor with script-runtime dependency. Use it in PsiChecker tests.

This commit is contained in:
Natalia Selezneva
2018-07-09 13:04:23 +03:00
committed by Ilya Chernikov
parent 3b8bf3e74e
commit 790188120a
7 changed files with 20 additions and 1 deletions
@@ -129,6 +129,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_REFLECT")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_REFLECT
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_SCRIPT_RUNTIME")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_SCRIPT_RUNTIME
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
@@ -130,6 +130,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_REFLECT")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_REFLECT
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_SCRIPT_RUNTIME")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_SCRIPT_RUNTIME
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.idea.test;
import com.intellij.openapi.projectRoots.Sdk;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.utils.PathUtil;
import java.io.File;
@@ -44,6 +43,12 @@ public class KotlinWithJdkAndRuntimeLightProjectDescriptor extends KotlinJdkAndL
PathUtil.getKotlinPathsForDistDirectory().getKotlinTestPath())
);
@NotNull
public static final KotlinWithJdkAndRuntimeLightProjectDescriptor INSTANCE_WITH_SCRIPT_RUNTIME = new KotlinWithJdkAndRuntimeLightProjectDescriptor(
Arrays.asList(ForTestCompileRuntime.runtimeJarForTests(),
PathUtil.getKotlinPathsForDistDirectory().getScriptRuntimePath())
);
@NotNull
public static final KotlinWithJdkAndRuntimeLightProjectDescriptor INSTANCE_WITH_REFLECT = new KotlinWithJdkAndRuntimeLightProjectDescriptor(
Arrays.asList(ForTestCompileRuntime.runtimeJarForTests(),
+2
View File
@@ -1,3 +1,5 @@
// RUNTIME_WITH_SCRIPT_RUNTIME
val c = true
if (c) {
2 + 3
+2
View File
@@ -1,3 +1,5 @@
// RUNTIME_WITH_SCRIPT_RUNTIME
package org.my
val x = 1
+2
View File
@@ -1,3 +1,5 @@
// RUNTIME_WITH_SCRIPT_RUNTIME
fun f() {
}
@@ -1,2 +1,4 @@
// RUNTIME_WITH_SCRIPT_RUNTIME
val x = <error descr="[UNINITIALIZED_VARIABLE] Variable 'y' must be initialized">y</error>
val y = 3