Migrate CompileKotlinAgainstKotlin test to multi-file framework
This commit is contained in:
committed by
Alexander Udalov
parent
5884d4be79
commit
cc8af573f9
+62
-35
@@ -18,16 +18,16 @@ package org.jetbrains.kotlin.jvm.compiler;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import kotlin.Pair;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleBuilder;
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.OutputUtilsKt;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles;
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
|
||||
import org.jetbrains.kotlin.codegen.ClassFileFactory;
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestCase;
|
||||
import org.jetbrains.kotlin.codegen.GenerationUtils;
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime;
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration;
|
||||
@@ -36,7 +36,6 @@ import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestCaseWithTmpdir;
|
||||
import org.jetbrains.kotlin.test.TestJdkKind;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
|
||||
@@ -47,77 +46,82 @@ import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWithTmpdir {
|
||||
public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTestCase {
|
||||
private File tmpdir;
|
||||
private File aDir;
|
||||
private File bDir;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
tmpdir = KotlinTestUtils.tmpDirForTest(this);
|
||||
aDir = new File(tmpdir, "a");
|
||||
bDir = new File(tmpdir, "b");
|
||||
KotlinTestUtils.mkdirs(aDir);
|
||||
KotlinTestUtils.mkdirs(bDir);
|
||||
}
|
||||
|
||||
public void doTest(@NotNull String fileName) throws Exception {
|
||||
compileA(new File(fileName));
|
||||
String fileNameB = fileName.replaceFirst("A\\.kt$", "B.kt");
|
||||
compileB(new File(fileNameB));
|
||||
invokeMain(fileNameB);
|
||||
@Override
|
||||
protected void doMultiFileTest(File file, Map<String, ModuleAndDependencies> modules, List<TestFile> files) throws Exception {
|
||||
// Note that it may be beneficial to improve this test to handle many files, compiling them successively against all previous
|
||||
assert files.size() == 2 : "There should be exactly two files in this test";
|
||||
TestFile fileA = files.get(0);
|
||||
TestFile fileB = files.get(1);
|
||||
compileA(fileA.name, fileA.content);
|
||||
compileB(fileB.name, fileB.content);
|
||||
invokeMain(fileB.name);
|
||||
}
|
||||
|
||||
|
||||
private void invokeMain(@NotNull String fileName) throws Exception {
|
||||
Method main = generatedClass(fileName).getMethod("main", String[].class);
|
||||
String className = PackagePartClassUtils.getFilePartShortName(fileName);
|
||||
Method main = createGeneratedClassLoader().loadClass(className).getMethod("main", String[].class);
|
||||
main.invoke(null, new Object[] {ArrayUtil.EMPTY_STRING_ARRAY});
|
||||
}
|
||||
|
||||
private void invokeBox(@NotNull String fileName) throws Exception {
|
||||
Method box = generatedClass(fileName).getMethod("box");
|
||||
private void invokeBox(@NotNull String className) throws Exception {
|
||||
Method box = createGeneratedClassLoader().loadClass(className).getMethod("box");
|
||||
String result = (String) box.invoke(null);
|
||||
assertEquals("OK", result);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Class<?> generatedClass(@NotNull String fileName) throws Exception {
|
||||
URLClassLoader classLoader = new URLClassLoader(
|
||||
private URLClassLoader createGeneratedClassLoader() throws Exception {
|
||||
return new URLClassLoader(
|
||||
new URL[]{ bDir.toURI().toURL(), aDir.toURI().toURL() },
|
||||
ForTestCompileRuntime.runtimeAndReflectJarClassLoader()
|
||||
);
|
||||
String fileLastName = new File(fileName).getName();
|
||||
return classLoader.loadClass(PackagePartClassUtils.getFilePartShortName(fileLastName));
|
||||
}
|
||||
|
||||
private ClassFileFactory compileA(@NotNull File ktAFile) throws IOException {
|
||||
KotlinCoreEnvironment jetCoreEnvironment = KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(),
|
||||
ConfigurationKind.ALL);
|
||||
return compileKotlin(ktAFile, aDir, jetCoreEnvironment, getTestRootDisposable());
|
||||
@NotNull
|
||||
private ClassFileFactory compileA(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||
KotlinCoreEnvironment environment =
|
||||
KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(), ConfigurationKind.ALL);
|
||||
return compileKotlin(fileName, content, aDir, environment, getTestRootDisposable());
|
||||
}
|
||||
|
||||
private ClassFileFactory compileB(@NotNull File ktBFile) throws IOException {
|
||||
@NotNull
|
||||
private ClassFileFactory compileB(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||
CompilerConfiguration configurationWithADirInClasspath = KotlinTestUtils
|
||||
.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar(), aDir);
|
||||
|
||||
KotlinCoreEnvironment environment =
|
||||
KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configurationWithADirInClasspath, EnvironmentConfigFiles.JVM_CONFIG_FILES);
|
||||
|
||||
return compileKotlin(ktBFile, bDir, environment, getTestRootDisposable());
|
||||
return compileKotlin(fileName, content, bDir, environment, getTestRootDisposable());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ClassFileFactory compileKotlin(
|
||||
@NotNull File file, @NotNull File outputDir, @NotNull KotlinCoreEnvironment jetCoreEnvironment,
|
||||
@NotNull String fileName, @NotNull String content, @NotNull File outputDir, @NotNull KotlinCoreEnvironment environment,
|
||||
@NotNull Disposable disposable
|
||||
) throws IOException {
|
||||
KtFile psiFile = KotlinTestUtils.createFile(fileName, content, environment.getProject());
|
||||
|
||||
String text = FileUtil.loadFile(file, true);
|
||||
ModuleVisibilityManager.SERVICE.getInstance(environment.getProject()).addModule(new ModuleBuilder("module for test", tmpdir.getAbsolutePath(), "test"));
|
||||
|
||||
KtFile psiFile = KotlinTestUtils.createFile(file.getName(), text, jetCoreEnvironment.getProject());
|
||||
|
||||
ModuleVisibilityManager.SERVICE.getInstance(jetCoreEnvironment.getProject()).addModule(new ModuleBuilder("module for test", tmpdir.getAbsolutePath(), "test"));
|
||||
|
||||
ClassFileFactory outputFiles = GenerationUtils.compileFileGetClassFileFactoryForTest(psiFile, jetCoreEnvironment);
|
||||
ClassFileFactory outputFiles = GenerationUtils.compileFileGetClassFileFactoryForTest(psiFile, environment);
|
||||
|
||||
OutputUtilsKt.writeAllTo(outputFiles, outputDir);
|
||||
|
||||
@@ -126,15 +130,38 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWit
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected Pair<ClassFileFactory, ClassFileFactory> doBoxTest(@NotNull String firstFileName) {
|
||||
List<String> files = Arrays.asList(firstFileName, StringsKt.substringBeforeLast(firstFileName, "1.kt", "") + "2.kt");
|
||||
protected Pair<ClassFileFactory, ClassFileFactory> doBoxTest(@NotNull String firstFileName) throws Exception {
|
||||
List<TestFile> files = KotlinTestUtils.createTestFiles(
|
||||
firstFileName, KotlinTestUtils.doLoadFile(new File(firstFileName)),
|
||||
new KotlinTestUtils.TestFileFactory<Void, TestFile>() {
|
||||
@Override
|
||||
public TestFile createFile(
|
||||
@Nullable Void module, @NotNull String fileName, @NotNull String text, @NotNull Map<String, String> directives
|
||||
) {
|
||||
return new TestFile(fileName, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void createModule(@NotNull String name, @NotNull List<String> dependencies) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: drop this (migrate codegen/box/inline/)
|
||||
if (files.size() == 1) {
|
||||
TestFile firstFile = files.iterator().next();
|
||||
File secondFile = new File(firstFileName.replace("1.kt", "2.kt"));
|
||||
files = Arrays.asList(firstFile, new TestFile(secondFile.getName(), KotlinTestUtils.doLoadFile(secondFile)));
|
||||
}
|
||||
|
||||
ClassFileFactory factory1 = null;
|
||||
ClassFileFactory factory2 = null;
|
||||
try {
|
||||
factory1 = compileA(new File(files.get(1)));
|
||||
factory2 = compileB(new File(files.get(0)));
|
||||
invokeBox(files.get(0));
|
||||
TestFile fileA = files.get(1);
|
||||
TestFile fileB = files.get(0);
|
||||
factory1 = compileA(fileA.name, fileA.content);
|
||||
factory2 = compileB(fileB.name, fileB.content);
|
||||
invokeBox(PackagePartClassUtils.getFilePartShortName(new File(fileB.name).getName()));
|
||||
}
|
||||
catch (Throwable e) {
|
||||
String result = "";
|
||||
|
||||
+57
-57
@@ -32,174 +32,174 @@ import java.util.regex.Pattern;
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInCompileKotlinAgainstKotlin() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.A.kt$"), true);
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/compileKotlinAgainstKotlin"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationInTrait.A.kt")
|
||||
@TestMetadata("annotationInTrait.kt")
|
||||
public void testAnnotationInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/AnnotationInTrait.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/annotationInTrait.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassInObject.A.kt")
|
||||
@TestMetadata("classInObject.kt")
|
||||
public void testClassInObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ClassInObject.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/classInObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjectInEnum.A.kt")
|
||||
@TestMetadata("classObjectInEnum.kt")
|
||||
public void testClassObjectInEnum() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ClassObjectInEnum.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/classObjectInEnum.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjectMember.A.kt")
|
||||
@TestMetadata("classObjectMember.kt")
|
||||
public void testClassObjectMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ClassObjectMember.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/classObjectMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ConstructorVararg.A.kt")
|
||||
@TestMetadata("constructorVararg.kt")
|
||||
public void testConstructorVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ConstructorVararg.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/constructorVararg.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("DefaultConstructor.A.kt")
|
||||
@TestMetadata("defaultConstructor.kt")
|
||||
public void testDefaultConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/DefaultConstructor.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/defaultConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("DoublyNestedClass.A.kt")
|
||||
@TestMetadata("doublyNestedClass.kt")
|
||||
public void testDoublyNestedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/DoublyNestedClass.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/doublyNestedClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Enum.A.kt")
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/Enum.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/enum.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ImportObject.A.kt")
|
||||
@TestMetadata("importObject.kt")
|
||||
public void testImportObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/ImportObject.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/importObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InlinedConstants.A.kt")
|
||||
@TestMetadata("inlinedConstants.kt")
|
||||
public void testInlinedConstants() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/inlinedConstants.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("InnerClassConstructor.A.kt")
|
||||
@TestMetadata("innerClassConstructor.kt")
|
||||
public void testInnerClassConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/InnerClassConstructor.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/innerClassConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmField.A.kt")
|
||||
@TestMetadata("jvmField.kt")
|
||||
public void testJvmField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmField.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmField.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmFieldInConstructor.A.kt")
|
||||
@TestMetadata("jvmFieldInConstructor.kt")
|
||||
public void testJvmFieldInConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmFieldInConstructor.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmFieldInConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JvmNameOnAccessor.A.kt")
|
||||
@TestMetadata("jvmNameOnAccessor.kt")
|
||||
public void testJvmNameOnAccessor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/JvmNameOnAccessor.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmNameOnAccessor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("KotlinPropertyAsAnnotationParameter.A.kt")
|
||||
@TestMetadata("kotlinPropertyAsAnnotationParameter.kt")
|
||||
public void testKotlinPropertyAsAnnotationParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/kotlinPropertyAsAnnotationParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("MultifileClassInlineFunctionAccessingProperty.A.kt")
|
||||
@TestMetadata("multifileClassInlineFunctionAccessingProperty.kt")
|
||||
public void testMultifileClassInlineFunctionAccessingProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/MultifileClassInlineFunctionAccessingProperty.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/multifileClassInlineFunctionAccessingProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NestedClass.A.kt")
|
||||
@TestMetadata("nestedClass.kt")
|
||||
public void testNestedClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/NestedClass.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/nestedClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NestedEnum.A.kt")
|
||||
@TestMetadata("nestedEnum.kt")
|
||||
public void testNestedEnum() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/NestedEnum.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/nestedEnum.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NestedObject.A.kt")
|
||||
@TestMetadata("nestedObject.kt")
|
||||
public void testNestedObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/NestedObject.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/nestedObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PlatformNames.A.kt")
|
||||
@TestMetadata("platformNames.kt")
|
||||
public void testPlatformNames() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PlatformNames.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/platformNames.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PlatformStaticInObject.A.kt")
|
||||
@TestMetadata("platformStaticInObject.kt")
|
||||
public void testPlatformStaticInObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PlatformStaticInObject.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/platformStaticInObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PlatformTypes.A.kt")
|
||||
@TestMetadata("platformTypes.kt")
|
||||
public void testPlatformTypes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/platformTypes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PropertyReference.A.kt")
|
||||
@TestMetadata("propertyReference.kt")
|
||||
public void testPropertyReference() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PropertyReference.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/propertyReference.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("RecursiveGeneric.A.kt")
|
||||
@TestMetadata("recursiveGeneric.kt")
|
||||
public void testRecursiveGeneric() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/RecursiveGeneric.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/recursiveGeneric.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SecondaryConstructors.A.kt")
|
||||
@TestMetadata("secondaryConstructors.kt")
|
||||
public void testSecondaryConstructors() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/SecondaryConstructors.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/secondaryConstructors.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Simple.A.kt")
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/Simple.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/simple.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SimpleValAnonymousObject.A.kt")
|
||||
@TestMetadata("simpleValAnonymousObject.kt")
|
||||
public void testSimpleValAnonymousObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/SimpleValAnonymousObject.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/simpleValAnonymousObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("StarImportEnum.A.kt")
|
||||
@TestMetadata("starImportEnum.kt")
|
||||
public void testStarImportEnum() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/StarImportEnum.A.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/starImportEnum.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
+48
-1
@@ -32,7 +32,54 @@ import java.util.regex.Pattern;
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class CompileKotlinAgainstMultifileKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInBoxMultifileClasses() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.1.kt$"), true);
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Calls extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInCalls() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("callFromOtherPackage.kt")
|
||||
public void testCallFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt");
|
||||
doBoxTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constFromOtherPackage.kt")
|
||||
public void testConstFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt");
|
||||
doBoxTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("valFromOtherPackage.kt")
|
||||
public void testValFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt");
|
||||
doBoxTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("varFromOtherPackage.kt")
|
||||
public void testVarFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt");
|
||||
doBoxTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Reflection extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInReflection() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("constPropertyReferenceFromMultifileClass.kt")
|
||||
public void testConstPropertyReferenceFromMultifileClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.kt");
|
||||
doBoxTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user