Use mock JDK in compiler tests where full JDK is not needed
- move some of boxWithStdlib tests under fullJdk/ directory, where they will be compiled against the full JDK - introduce FULL_JDK in-text directive for the reflection test as only 4 tests out of 654 needed the full JDK
This commit is contained in:
+8
-3
@@ -33,6 +33,7 @@ import org.jetbrains.kotlin.idea.JetFileType;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.JetTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestJdkKind;
|
||||
import org.jetbrains.kotlin.utils.Printer;
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -137,9 +138,13 @@ public class CodegenTestsOnAndroidGenerator extends UsefulTestCase {
|
||||
}
|
||||
|
||||
private KotlinCoreEnvironment createEnvironment(boolean isFullJdk) {
|
||||
return isFullJdk
|
||||
? JetTestUtils.createEnvironmentWithFullJdk(myTestRootDisposable)
|
||||
: JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS);
|
||||
return isFullJdk ?
|
||||
JetTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
|
||||
myTestRootDisposable, ConfigurationKind.ALL, TestJdkKind.FULL_JDK
|
||||
) :
|
||||
JetTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(
|
||||
myTestRootDisposable, ConfigurationKind.JDK_AND_ANNOTATIONS
|
||||
);
|
||||
}
|
||||
|
||||
public boolean shouldWriteFilesOnDisk() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FULL_JDK
|
||||
import javaFields as J
|
||||
|
||||
import java.lang.reflect.*
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FULL_JDK
|
||||
package test;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FULL_JDK
|
||||
package test
|
||||
|
||||
import java.util.AbstractList
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FULL_JDK
|
||||
package test
|
||||
|
||||
class C: java.util.ArrayList<String>()
|
||||
class C: java.util.ArrayList<String>()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FULL_JDK
|
||||
package test
|
||||
|
||||
class C: java.util.ArrayList<String?>()
|
||||
class C: java.util.ArrayList<String?>()
|
||||
|
||||
+26
-8
@@ -19,7 +19,9 @@ package org.jetbrains.kotlin.codegen.generated;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import kotlin.Charsets;
|
||||
import kotlin.KotlinPackage;
|
||||
import kotlin.io.IoPackage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsPackage;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
@@ -29,6 +31,7 @@ import org.jetbrains.kotlin.codegen.GenerationUtils;
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||
import org.jetbrains.kotlin.psi.JetFile;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
|
||||
import org.jetbrains.kotlin.test.JetTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestJdkKind;
|
||||
import org.jetbrains.kotlin.utils.UtilsPackage;
|
||||
@@ -63,7 +66,9 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
}
|
||||
|
||||
public void doTestWithStdlib(@NotNull String filename) {
|
||||
myEnvironment = JetTestUtils.createEnvironmentWithFullJdk(getTestRootDisposable());
|
||||
myEnvironment = JetTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
|
||||
getTestRootDisposable(), ConfigurationKind.ALL, getTestJdkKind(filename)
|
||||
);
|
||||
blackBoxFileByFullPath(filename);
|
||||
}
|
||||
|
||||
@@ -89,16 +94,29 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
blackBox();
|
||||
}
|
||||
|
||||
// NOTE: tests under fullJdk/ are run with FULL_JDK instead of MOCK_JDK
|
||||
@NotNull
|
||||
private static TestJdkKind getTestJdkKind(@NotNull String sourcePath) {
|
||||
if (sourcePath.contains("compiler/testData/codegen/boxWithStdlib/fullJdk")) {
|
||||
return TestJdkKind.FULL_JDK;
|
||||
}
|
||||
|
||||
return InTextDirectivesUtils.isDirectiveDefined(
|
||||
IoPackage.readText(new File(sourcePath), Charsets.UTF_8), "FULL_JDK"
|
||||
) ? TestJdkKind.FULL_JDK : TestJdkKind.MOCK_JDK;
|
||||
}
|
||||
|
||||
private void blackBoxFileAgainstJavaByFullPath(@NotNull String ktFileFullPath) {
|
||||
String ktFile = relativePath(new File(ktFileFullPath));
|
||||
File javaClassesTempDirectory = compileJava(ktFile.replaceFirst("\\.kt$", ".java"));
|
||||
|
||||
myEnvironment =
|
||||
KotlinCoreEnvironment.createForTests(getTestRootDisposable(),
|
||||
JetTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.FULL_JDK,
|
||||
JetTestUtils.getAnnotationsJar(),
|
||||
javaClassesTempDirectory),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
myEnvironment = KotlinCoreEnvironment.createForTests(
|
||||
getTestRootDisposable(),
|
||||
JetTestUtils.compilerConfigurationForTests(
|
||||
ConfigurationKind.ALL, getTestJdkKind(ktFileFullPath), JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory
|
||||
),
|
||||
EnvironmentConfigFiles.JVM_CONFIG_FILES
|
||||
);
|
||||
|
||||
loadFile(ktFile);
|
||||
blackBox();
|
||||
@@ -124,7 +142,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
});
|
||||
|
||||
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
|
||||
ConfigurationKind.ALL, TestJdkKind.FULL_JDK, JetTestUtils.getAnnotationsJar()
|
||||
ConfigurationKind.ALL, getTestJdkKind(directory), JetTestUtils.getAnnotationsJar()
|
||||
);
|
||||
addJvmClasspathRoot(configuration, dirFile);
|
||||
myEnvironment = KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
|
||||
+134
-134
@@ -50,11 +50,9 @@ import java.util.regex.Pattern;
|
||||
BlackBoxWithStdlibCodegenTestGenerated.LazyCodegen.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.LocalFunInLambda.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.MultiDeclForArray.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.Native.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.NonLocalReturns.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.PlatformNames.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.PlatformStatic.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.PlatformTypes.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.Ranges.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.Reflection.class,
|
||||
BlackBoxWithStdlibCodegenTestGenerated.Regressions.class,
|
||||
@@ -100,12 +98,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmFlags.kt")
|
||||
public void testJvmFlags() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/annotations/jvmFlags.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kotlinPropertyFromClassObjectAsParameter.kt")
|
||||
public void testKotlinPropertyFromClassObjectAsParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt");
|
||||
@@ -1410,6 +1402,8 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@InnerTestClasses({
|
||||
FullJdk.Native.class,
|
||||
FullJdk.Regressions.class,
|
||||
FullJdk.Synchronized.class,
|
||||
})
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1448,6 +1442,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmAnnotationFlags.kt")
|
||||
public void testJvmAnnotationFlags() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/jvmAnnotationFlags.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2423.kt")
|
||||
public void testKt2423() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/kt2423.kt");
|
||||
@@ -1466,6 +1466,126 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("platformTypeAssertionStackTrace.kt")
|
||||
public void testPlatformTypeAssertionStackTrace() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/platformTypeAssertionStackTrace.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/native")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Native extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInNative() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/fullJdk/native"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("default.kt")
|
||||
public void testDefault() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/native/default.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nativePropertyAccessors.kt")
|
||||
public void testNativePropertyAccessors() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/native/nativePropertyAccessors.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateStatic.kt")
|
||||
public void testPrivateStatic() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/native/privateStatic.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleNative.kt")
|
||||
public void testSimpleNative() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/native/simpleNative.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticNative.kt")
|
||||
public void testStaticNative() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/native/staticNative.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/native/topLevel.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Regressions extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInRegressions() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("collections.kt")
|
||||
public void testCollections() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/collections.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1202.kt")
|
||||
public void testKt1202() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt1202.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1406.kt")
|
||||
public void testKt1406() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt1406.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1770.kt")
|
||||
public void testKt1770() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt1770.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt274.kt")
|
||||
public void testKt274() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt274.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt528.kt")
|
||||
public void testKt528() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt528.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt529.kt")
|
||||
public void testKt529() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt529.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt533.kt")
|
||||
public void testKt533() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt533.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6485.kt")
|
||||
public void testKt6485() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt6485.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt864.kt")
|
||||
public void testKt864() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/regressions/kt864.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/synchronized")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1510,6 +1630,12 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturn.kt")
|
||||
public void testNonLocalReturn() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/synchronized/nonLocalReturn.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectValue.kt")
|
||||
public void testObjectValue() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/fullJdk/synchronized/objectValue.kt");
|
||||
@@ -1975,51 +2101,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/native")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Native extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInNative() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/native"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("default.kt")
|
||||
public void testDefault() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/default.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nativePropertyAccessors.kt")
|
||||
public void testNativePropertyAccessors() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/nativePropertyAccessors.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privateStatic.kt")
|
||||
public void testPrivateStatic() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/privateStatic.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleNative.kt")
|
||||
public void testSimpleNative() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/simpleNative.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("staticNative.kt")
|
||||
public void testStaticNative() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/staticNative.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevel.kt")
|
||||
public void testTopLevel() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/native/topLevel.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/nonLocalReturns")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -2028,12 +2109,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/nonLocalReturns"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("synchronized.kt")
|
||||
public void testSynchronized() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/nonLocalReturns/synchronized.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("use.kt")
|
||||
public void testUse() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/nonLocalReturns/use.kt");
|
||||
@@ -2173,21 +2248,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/platformTypes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PlatformTypes extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInPlatformTypes() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/platformTypes"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("assertionStackTrace.kt")
|
||||
public void testAssertionStackTrace() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/platformTypes/assertionStackTrace.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxWithStdlib/ranges")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@InnerTestClasses({
|
||||
@@ -2994,12 +3054,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithStdlib/regressions"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("collections.kt")
|
||||
public void testCollections() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/collections.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("generic.kt")
|
||||
public void testGeneric() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/generic.kt");
|
||||
@@ -3024,18 +3078,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1202.kt")
|
||||
public void testKt1202() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt1202.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1406.kt")
|
||||
public void testKt1406() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt1406.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1568.kt")
|
||||
public void testKt1568() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt1568.kt");
|
||||
@@ -3048,12 +3090,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1770.kt")
|
||||
public void testKt1770() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt1770.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1779.kt")
|
||||
public void testKt1779() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt1779.kt");
|
||||
@@ -3108,12 +3144,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt274.kt")
|
||||
public void testKt274() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt274.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt3046.kt")
|
||||
public void testKt3046() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt3046.kt");
|
||||
@@ -3156,24 +3186,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt528.kt")
|
||||
public void testKt528() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt528.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt529.kt")
|
||||
public void testKt529() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt529.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt533.kt")
|
||||
public void testKt533() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt533.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5395.kt")
|
||||
public void testKt5395() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt5395.kt");
|
||||
@@ -3210,12 +3222,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt864.kt")
|
||||
public void testKt864() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt864.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt998.kt")
|
||||
public void testKt998() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/regressions/kt998.kt");
|
||||
@@ -3315,12 +3321,6 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6485.kt")
|
||||
public void testKt6485() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reified/kt6485.kt");
|
||||
doTestWithStdlib(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedReified.kt")
|
||||
public void testNestedReified() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithStdlib/reified/nestedReified.kt");
|
||||
|
||||
+10
-4
@@ -81,14 +81,18 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
|
||||
if (InTextDirectivesUtils.isDirectiveDefined(text, "SKIP_IN_RUNTIME_TEST")) return
|
||||
|
||||
compileFile(file, text)
|
||||
val jdkKind =
|
||||
if (InTextDirectivesUtils.isDirectiveDefined(text, "FULL_JDK")) TestJdkKind.FULL_JDK
|
||||
else TestJdkKind.MOCK_JDK
|
||||
|
||||
compileFile(file, text, jdkKind)
|
||||
|
||||
val classLoader = URLClassLoader(array(tmpdir.toURI().toURL()), ForTestCompileRuntime.runtimeJarClassLoader())
|
||||
|
||||
val actual = createReflectedPackageView(classLoader)
|
||||
|
||||
val expected = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
|
||||
tmpdir, getTestRootDisposable(), TestJdkKind.FULL_JDK, ConfigurationKind.ALL
|
||||
tmpdir, getTestRootDisposable(), jdkKind, ConfigurationKind.ALL
|
||||
).first
|
||||
|
||||
val comparatorConfiguration = Configuration(
|
||||
@@ -104,7 +108,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
RecursiveDescriptorComparator.validateAndCompareDescriptors(expected, actual, comparatorConfiguration, null)
|
||||
}
|
||||
|
||||
private fun compileFile(file: File, text: String) {
|
||||
private fun compileFile(file: File, text: String, jdkKind: TestJdkKind) {
|
||||
val fileName = file.getName()
|
||||
when {
|
||||
fileName.endsWith(".java") -> {
|
||||
@@ -118,7 +122,9 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
|
||||
LoadDescriptorUtil.compileJavaWithAnnotationsJar(sources, tmpdir)
|
||||
}
|
||||
fileName.endsWith(".kt") -> {
|
||||
val environment = JetTestUtils.createEnvironmentWithFullJdk(myTestRootDisposable)
|
||||
val environment = JetTestUtils.createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(
|
||||
myTestRootDisposable, ConfigurationKind.ALL, jdkKind
|
||||
)
|
||||
val jetFile = JetTestUtils.createFile(file.getPath(), addRuntimeRetentionToKotlinSource(text), environment.project)
|
||||
GenerationUtils.compileFileGetClassFileFactoryForTest(jetFile).writeAllTo(tmpdir)
|
||||
}
|
||||
|
||||
@@ -18,15 +18,15 @@ package org.jetbrains.kotlin.repl
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.JetTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import org.jetbrains.kotlin.cli.jvm.repl.ReplInterpreter
|
||||
import org.junit.Assert
|
||||
import java.io.File
|
||||
import java.util.ArrayDeque
|
||||
import java.util.ArrayList
|
||||
import java.util.regex.Pattern
|
||||
import org.junit.Assert
|
||||
|
||||
private val START_PATTERN = Pattern.compile(">>>( *)(.*)$")
|
||||
private val INCOMPLETE_PATTERN = Pattern.compile("\\.\\.\\.( *)(.*)$")
|
||||
@@ -76,7 +76,7 @@ public abstract class AbstractReplInterpreterTest : UsefulTestCase() {
|
||||
}
|
||||
|
||||
protected fun doTest(path: String) {
|
||||
val configuration = JetTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.FULL_JDK)
|
||||
val configuration = JetTestUtils.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK)
|
||||
val repl = ReplInterpreter(getTestRootDisposable()!!, configuration)
|
||||
|
||||
for ((code, expected) in loadLines(File(path))) {
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.regex.Pattern;
|
||||
public class LoadBuiltinsTest extends KotlinTestWithEnvironment {
|
||||
@Override
|
||||
protected KotlinCoreEnvironment createEnvironment() {
|
||||
return createEnvironmentWithJdk(ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.FULL_JDK);
|
||||
return createEnvironmentWithJdk(ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.MOCK_JDK);
|
||||
}
|
||||
|
||||
public void testBuiltIns() throws Exception {
|
||||
|
||||
@@ -250,12 +250,6 @@ public class JetTestUtils {
|
||||
return JvmResolveUtil.analyzeOneFileWithJavaIntegration(file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static KotlinCoreEnvironment createEnvironmentWithFullJdk(Disposable disposable) {
|
||||
return createEnvironmentWithJdkAndNullabilityAnnotationsFromIdea(disposable,
|
||||
ConfigurationKind.ALL, TestJdkKind.FULL_JDK);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static KotlinCoreEnvironment createEnvironmentWithMockJdkAndIdeaAnnotations(Disposable disposable) {
|
||||
return createEnvironmentWithMockJdkAndIdeaAnnotations(disposable, ConfigurationKind.ALL);
|
||||
|
||||
Reference in New Issue
Block a user