Add LightProjectDescriptor with script-runtime dependency. Use it in PsiChecker tests.
This commit is contained in:
committed by
Ilya Chernikov
parent
3b8bf3e74e
commit
790188120a
+3
@@ -129,6 +129,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_REFLECT")) {
|
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_REFLECT")) {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_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") ||
|
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
|
||||||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
|
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|||||||
+3
@@ -130,6 +130,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
|
|||||||
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_REFLECT")) {
|
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_REFLECT")) {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_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") ||
|
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
|
||||||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
|
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
|
||||||
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||||
|
|||||||
+6
-1
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.idea.test;
|
|||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
|
||||||
import org.jetbrains.kotlin.utils.PathUtil;
|
import org.jetbrains.kotlin.utils.PathUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -44,6 +43,12 @@ public class KotlinWithJdkAndRuntimeLightProjectDescriptor extends KotlinJdkAndL
|
|||||||
PathUtil.getKotlinPathsForDistDirectory().getKotlinTestPath())
|
PathUtil.getKotlinPathsForDistDirectory().getKotlinTestPath())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static final KotlinWithJdkAndRuntimeLightProjectDescriptor INSTANCE_WITH_SCRIPT_RUNTIME = new KotlinWithJdkAndRuntimeLightProjectDescriptor(
|
||||||
|
Arrays.asList(ForTestCompileRuntime.runtimeJarForTests(),
|
||||||
|
PathUtil.getKotlinPathsForDistDirectory().getScriptRuntimePath())
|
||||||
|
);
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static final KotlinWithJdkAndRuntimeLightProjectDescriptor INSTANCE_WITH_REFLECT = new KotlinWithJdkAndRuntimeLightProjectDescriptor(
|
public static final KotlinWithJdkAndRuntimeLightProjectDescriptor INSTANCE_WITH_REFLECT = new KotlinWithJdkAndRuntimeLightProjectDescriptor(
|
||||||
Arrays.asList(ForTestCompileRuntime.runtimeJarForTests(),
|
Arrays.asList(ForTestCompileRuntime.runtimeJarForTests(),
|
||||||
|
|||||||
Vendored
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// RUNTIME_WITH_SCRIPT_RUNTIME
|
||||||
|
|
||||||
val c = true
|
val c = true
|
||||||
if (c) {
|
if (c) {
|
||||||
2 + 3
|
2 + 3
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// RUNTIME_WITH_SCRIPT_RUNTIME
|
||||||
|
|
||||||
package org.my
|
package org.my
|
||||||
|
|
||||||
val x = 1
|
val x = 1
|
||||||
+2
@@ -1,3 +1,5 @@
|
|||||||
|
// RUNTIME_WITH_SCRIPT_RUNTIME
|
||||||
|
|
||||||
fun f() {
|
fun f() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
// RUNTIME_WITH_SCRIPT_RUNTIME
|
||||||
|
|
||||||
val x = <error descr="[UNINITIALIZED_VARIABLE] Variable 'y' must be initialized">y</error>
|
val x = <error descr="[UNINITIALIZED_VARIABLE] Variable 'y' must be initialized">y</error>
|
||||||
val y = 3
|
val y = 3
|
||||||
Reference in New Issue
Block a user