Migrate boxMultiFile and boxMultifileClass tests to new multi-file tests

AbstractCompileKotlinAgainstMultifileKotlinTest is broken in this commit; will
be fixed later
This commit is contained in:
Alexander Udalov
2016-02-23 20:13:16 +03:00
parent 4fb0453cea
commit e0b6f12737
91 changed files with 700 additions and 615 deletions
@@ -60,7 +60,7 @@ import static org.jetbrains.kotlin.codegen.CodegenTestUtil.*;
import static org.jetbrains.kotlin.test.KotlinTestUtils.compilerConfigurationForTests;
import static org.jetbrains.kotlin.test.KotlinTestUtils.getAnnotationsJar;
public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava<Void, File> {
public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava<Void, CodegenTestCase.TestFile> {
private static final String DEFAULT_TEST_FILE_NAME = "a_test";
protected KotlinCoreEnvironment myEnvironment;
@@ -326,6 +326,21 @@ public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava<Void,
}
}
public static class TestFile implements Comparable<TestFile> {
public final String name;
public final String content;
public TestFile(@NotNull String name, @NotNull String content) {
this.name = name;
this.content = content;
}
@Override
public int compareTo(@NotNull TestFile o) {
return name.compareTo(o.name);
}
}
@Override
protected Void createTestModule(@NotNull String name) {
// TODO: support multi-module codegen tests
@@ -333,12 +348,12 @@ public abstract class CodegenTestCase extends KotlinMultiFileTestWithJava<Void,
}
@Override
protected File createTestFile(Void module, String fileName, String text, Map<String, String> directives) {
return new File(fileName);
protected TestFile createTestFile(Void module, String fileName, String text, Map<String, String> directives) {
return new TestFile(fileName, text);
}
@Override
protected void doMultiFileTest(File file, Map<String, ModuleAndDependencies> modules, List<File> files) throws Exception {
protected void doMultiFileTest(File file, Map<String, ModuleAndDependencies> modules, List<TestFile> files) throws Exception {
throw new UnsupportedOperationException("Multi-file test cases are not supported in this test");
}
}
@@ -81,24 +81,29 @@ public class CodegenTestFiles {
return psiFiles;
}
@NotNull
public static CodegenTestFiles create(@NotNull List<KtFile> ktFiles) {
assert !ktFiles.isEmpty() : "List should have at least one file";
return new CodegenTestFiles(ktFiles, Collections.<Pair<String, String>>emptyList(), Collections.emptyList());
}
public static CodegenTestFiles create(Project project, String[] names) {
return create(project, names, KotlinTestUtils.getTestDataPathBase());
}
public static CodegenTestFiles create(Project project, String[] names, String testDataPath) {
ArrayList<KtFile> files = new ArrayList<KtFile>();
List<KtFile> files = new ArrayList<KtFile>(names.length);
for (String name : names) {
try {
String content = KotlinTestUtils.doLoadFile(testDataPath + "/codegen/", name);
int i = name.lastIndexOf('/');
//name = name.substring(i+1);
KtFile file = KotlinTestUtils.createFile(name, content, project);
files.add(file);
} catch (IOException e) {
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
return new CodegenTestFiles(files, Collections.<Pair<String, String>>emptyList(), Collections.emptyList());
return create(files);
}
@NotNull
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider;
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment;
import org.jetbrains.kotlin.cli.jvm.config.JvmContentRootsKt;
import org.jetbrains.kotlin.codegen.CodegenTestCase;
import org.jetbrains.kotlin.codegen.CodegenTestFiles;
import org.jetbrains.kotlin.codegen.GeneratedClassLoader;
import org.jetbrains.kotlin.codegen.GenerationUtils;
import org.jetbrains.kotlin.config.CompilerConfiguration;
@@ -50,10 +51,14 @@ import static org.jetbrains.kotlin.codegen.CodegenTestUtil.compileJava;
public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
@Override
protected void doMultiFileTest(File file, Map<String, ModuleAndDependencies> modules, List<File> files) throws Exception {
assert files.size() == 1 : "Multi-file test cases are not supported yet in this test";
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
blackBoxFileByFullPath(file.getPath());
protected void doMultiFileTest(File file, Map<String, ModuleAndDependencies> modules, List<TestFile> files) throws Exception {
if (files.size() == 1) {
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY);
blackBoxFileByFullPath(file.getPath());
}
else {
doTestMultiFile(files);
}
}
public void doTestAgainstJava(@NotNull String filename) {
@@ -81,25 +86,17 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
blackBoxFileByFullPath(filename);
}
public void doTestMultiFile(@NotNull String folderName) {
final List<String> files = new ArrayList<String>(2);
FileUtil.processFilesRecursively(new File(folderName), new Processor<File>() {
@Override
public boolean process(File file) {
if (file.getName().endsWith(".kt")) {
files.add(relativePath(file));
}
return true;
}
});
doTestMultiFile(files);
}
protected void doTestMultiFile(@NotNull List<String> files) {
private void doTestMultiFile(@NotNull List<TestFile> files) {
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL);
Collections.sort(files);
loadFiles(ArrayUtil.toStringArray(files));
List<KtFile> ktFiles = new ArrayList<KtFile>(files.size());
for (TestFile file : files) {
ktFiles.add(KotlinTestUtils.createFile(file.name, file.content, myEnvironment.getProject()));
}
myFiles = CodegenTestFiles.create(ktFiles);
blackBox();
}
@@ -20,15 +20,18 @@ import org.jetbrains.kotlin.codegen.InlineTestUtil
import org.jetbrains.kotlin.codegen.filterClassFiles
import org.jetbrains.kotlin.codegen.getClassFiles
import org.jetbrains.kotlin.jvm.compiler.AbstractSMAPBaseTest
import org.jetbrains.kotlin.test.ConfigurationKind
import java.io.File
abstract class AbstractBlackBoxInlineCodegenTest : AbstractBlackBoxCodegenTest(), AbstractSMAPBaseTest {
fun doTestMultiFileWithInlineCheck(firstFileName: String) {
val fileName = relativePath(File(firstFileName))
val inputFiles = listOf(fileName, fileName.substringBeforeLast("1.kt") + "2.kt")
doTestMultiFile(inputFiles)
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL)
loadFiles(*inputFiles.toTypedArray())
blackBox()
try {
InlineTestUtil.checkNoCallsToInline(initializedClassLoader.allGeneratedFiles.filterClassFiles(), myFiles.psiFiles)
checkSMAP(myFiles.psiFiles, generateClassesInFile().getClassFiles())
@@ -27,155 +27,215 @@ import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxMultiFile")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class BlackBoxMultiFileCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
@TestMetadata("accessorForProtected")
public void testAccessorForProtected() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtected/");
doTestMultiFile(fileName);
@TestMetadata("compiler/testData/codegen/boxMultiFile")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxMultiFile extends AbstractBlackBoxCodegenTest {
@TestMetadata("accessorForProtected.kt")
public void testAccessorForProtected() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtected.kt");
doTest(fileName);
}
@TestMetadata("accessorForProtectedInvokeVirtual.kt")
public void testAccessorForProtectedInvokeVirtual() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual.kt");
doTest(fileName);
}
public void testAllFilesPresentInBoxMultiFile() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultiFile"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("callMultifileClassMemberFromOtherPackage.kt")
public void testCallMultifileClassMemberFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage.kt");
doTest(fileName);
}
@TestMetadata("inlineMultifileClassMemberFromOtherPackage.kt")
public void testInlineMultifileClassMemberFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage.kt");
doTest(fileName);
}
@TestMetadata("internalVisibility.kt")
public void testInternalVisibility() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/internalVisibility.kt");
doTest(fileName);
}
@TestMetadata("kt10047.kt")
public void testKt10047() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt10047.kt");
doTest(fileName);
}
@TestMetadata("kt1515.kt")
public void testKt1515() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1515.kt");
doTest(fileName);
}
@TestMetadata("kt1528.kt")
public void testKt1528() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1528.kt");
doTest(fileName);
}
@TestMetadata("kt1845.kt")
public void testKt1845() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1845.kt");
doTest(fileName);
}
@TestMetadata("kt2060.kt")
public void testKt2060() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt2060.kt");
doTest(fileName);
}
@TestMetadata("kt5445.kt")
public void testKt5445() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445.kt");
doTest(fileName);
}
@TestMetadata("kt5445_2.kt")
public void testKt5445_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445_2.kt");
doTest(fileName);
}
@TestMetadata("kt9717.kt")
public void testKt9717() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717.kt");
doTest(fileName);
}
@TestMetadata("kt9717DifferentPackages.kt")
public void testKt9717DifferentPackages() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages.kt");
doTest(fileName);
}
@TestMetadata("kt9958.kt")
public void testKt9958() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958.kt");
doTest(fileName);
}
@TestMetadata("kt9958Interface.kt")
public void testKt9958Interface() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958Interface.kt");
doTest(fileName);
}
@TestMetadata("mainInFiles.kt")
public void testMainInFiles() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/mainInFiles.kt");
doTest(fileName);
}
@TestMetadata("multifileClassPartsInitialization.kt")
public void testMultifileClassPartsInitialization() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization.kt");
doTest(fileName);
}
@TestMetadata("packageLocalClassNotImportedWithDefaultImport.kt")
public void testPackageLocalClassNotImportedWithDefaultImport() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport.kt");
doTest(fileName);
}
@TestMetadata("protectedFromLambda.kt")
public void testProtectedFromLambda() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/protectedFromLambda.kt");
doTest(fileName);
}
@TestMetadata("samWrappersDifferentFiles.kt")
public void testSamWrappersDifferentFiles() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles.kt");
doTest(fileName);
}
@TestMetadata("sameFileName.kt")
public void testSameFileName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/sameFileName.kt");
doTest(fileName);
}
@TestMetadata("samePartNameDifferentFacades.kt")
public void testSamePartNameDifferentFacades() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades.kt");
doTest(fileName);
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/simple.kt");
doTest(fileName);
}
}
@TestMetadata("accessorForProtectedInvokeVirtual")
public void testAccessorForProtectedInvokeVirtual() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual/");
doTestMultiFile(fileName);
}
@TestMetadata("compiler/testData/codegen/boxMultifileClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class BoxMultifileClasses extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInBoxMultifileClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.kt$"), true);
}
public void testAllFilesPresentInBoxMultiFile() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultiFile"), Pattern.compile("^([^\\.]+)$"), false);
}
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Calls extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInCalls() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("callMultifileClassMemberFromOtherPackage")
public void testCallMultifileClassMemberFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage/");
doTestMultiFile(fileName);
}
@TestMetadata("callFromOtherPackage.kt")
public void testCallFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt");
doTest(fileName);
}
@TestMetadata("inlineMultifileClassMemberFromOtherPackage")
public void testInlineMultifileClassMemberFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage/");
doTestMultiFile(fileName);
}
@TestMetadata("constFromOtherPackage.kt")
public void testConstFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt");
doTest(fileName);
}
@TestMetadata("internalVisibility")
public void testInternalVisibility() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/internalVisibility/");
doTestMultiFile(fileName);
}
@TestMetadata("valFromOtherPackage.kt")
public void testValFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt");
doTest(fileName);
}
@TestMetadata("kt10047")
public void testKt10047() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt10047/");
doTestMultiFile(fileName);
}
@TestMetadata("varFromOtherPackage.kt")
public void testVarFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt");
doTest(fileName);
}
}
@TestMetadata("kt1515")
public void testKt1515() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1515/");
doTestMultiFile(fileName);
}
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Reflection extends AbstractBlackBoxCodegenTest {
public void testAllFilesPresentInReflection() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("kt1528")
public void testKt1528() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1528/");
doTestMultiFile(fileName);
}
@TestMetadata("kt1845")
public void testKt1845() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt1845/");
doTestMultiFile(fileName);
}
@TestMetadata("kt2060")
public void testKt2060() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt2060/");
doTestMultiFile(fileName);
}
@TestMetadata("kt5445")
public void testKt5445() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445/");
doTestMultiFile(fileName);
}
@TestMetadata("kt5445_2")
public void testKt5445_2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt5445_2/");
doTestMultiFile(fileName);
}
@TestMetadata("kt9717")
public void testKt9717() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717/");
doTestMultiFile(fileName);
}
@TestMetadata("kt9717DifferentPackages")
public void testKt9717DifferentPackages() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9717DifferentPackages/");
doTestMultiFile(fileName);
}
@TestMetadata("kt9958")
public void testKt9958() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958/");
doTestMultiFile(fileName);
}
@TestMetadata("kt9958Interface")
public void testKt9958Interface() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/kt9958Interface/");
doTestMultiFile(fileName);
}
@TestMetadata("mainInFiles")
public void testMainInFiles() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/mainInFiles/");
doTestMultiFile(fileName);
}
@TestMetadata("multifileClassPartsInitialization")
public void testMultifileClassPartsInitialization() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/multifileClassPartsInitialization/");
doTestMultiFile(fileName);
}
@TestMetadata("packageLocalClassNotImportedWithDefaultImport")
public void testPackageLocalClassNotImportedWithDefaultImport() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/");
doTestMultiFile(fileName);
}
@TestMetadata("protectedFromLambda")
public void testProtectedFromLambda() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/protectedFromLambda/");
doTestMultiFile(fileName);
}
@TestMetadata("samWrappersDifferentFiles")
public void testSamWrappersDifferentFiles() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samWrappersDifferentFiles/");
doTestMultiFile(fileName);
}
@TestMetadata("sameFileName")
public void testSameFileName() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/sameFileName/");
doTestMultiFile(fileName);
}
@TestMetadata("samePartNameDifferentFacades")
public void testSamePartNameDifferentFacades() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/samePartNameDifferentFacades/");
doTestMultiFile(fileName);
}
@TestMetadata("simple")
public void testSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/simple/");
doTestMultiFile(fileName);
@TestMetadata("constPropertyReferenceFromMultifileClass.kt")
public void testConstPropertyReferenceFromMultifileClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.kt");
doTest(fileName);
}
}
}
}
@@ -1,30 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.jvm.compiler
import org.jetbrains.kotlin.codegen.generated.AbstractBlackBoxCodegenTest
import java.io.File
abstract class AbstractBlackBoxMultifileClassCodegenTest: AbstractBlackBoxCodegenTest() {
fun doTestMultifileClassAgainstSources(firstFileName: String) {
val fileName = relativePath(File(firstFileName))
val inputFiles = listOf(fileName, fileName.substringBeforeLast("1.kt") + "2.kt")
doTestMultiFile(inputFiles)
}
}
@@ -1,85 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.jvm.compiler;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/testData/codegen/boxMultifileClasses")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public class BlackBoxMultifileClassKotlinTestGenerated extends AbstractBlackBoxMultifileClassCodegenTest {
public void testAllFilesPresentInBoxMultifileClasses() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.1.kt$"), true);
}
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Calls extends AbstractBlackBoxMultifileClassCodegenTest {
public void testAllFilesPresentInCalls() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.1.kt$"), true);
}
@TestMetadata("callFromOtherPackage.1.kt")
public void testCallFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.1.kt");
doTestMultifileClassAgainstSources(fileName);
}
@TestMetadata("constFromOtherPackage.1.kt")
public void testConstFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.1.kt");
doTestMultifileClassAgainstSources(fileName);
}
@TestMetadata("valFromOtherPackage.1.kt")
public void testValFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.1.kt");
doTestMultifileClassAgainstSources(fileName);
}
@TestMetadata("varFromOtherPackage.1.kt")
public void testVarFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.1.kt");
doTestMultifileClassAgainstSources(fileName);
}
}
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Reflection extends AbstractBlackBoxMultifileClassCodegenTest {
public void testAllFilesPresentInReflection() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.1.kt$"), true);
}
@TestMetadata("constFromMultifileClass.1.kt")
public void testConstFromMultifileClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.1.kt");
doTestMultifileClassAgainstSources(fileName);
}
}
}
@@ -35,51 +35,4 @@ public class CompileKotlinAgainstMultifileKotlinTestGenerated extends AbstractCo
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses"), Pattern.compile("^(.+)\\.1.kt$"), true);
}
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/calls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Calls extends AbstractCompileKotlinAgainstMultifileKotlinTest {
public void testAllFilesPresentInCalls() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/calls"), Pattern.compile("^(.+)\\.1.kt$"), true);
}
@TestMetadata("callFromOtherPackage.1.kt")
public void testCallFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.1.kt");
doBoxTest(fileName);
}
@TestMetadata("constFromOtherPackage.1.kt")
public void testConstFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.1.kt");
doBoxTest(fileName);
}
@TestMetadata("valFromOtherPackage.1.kt")
public void testValFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.1.kt");
doBoxTest(fileName);
}
@TestMetadata("varFromOtherPackage.1.kt")
public void testVarFromOtherPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.1.kt");
doBoxTest(fileName);
}
}
@TestMetadata("compiler/testData/codegen/boxMultifileClasses/reflection")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Reflection extends AbstractCompileKotlinAgainstMultifileKotlinTest {
public void testAllFilesPresentInReflection() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultifileClasses/reflection"), Pattern.compile("^(.+)\\.1.kt$"), true);
}
@TestMetadata("constFromMultifileClass.1.kt")
public void testConstFromMultifileClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constFromMultifileClass.1.kt");
doBoxTest(fileName);
}
}
}