Get rid of CompileKotlinAgainstMultifileKotlinTestGenerated and boxMultifileClasses/
Merge tests in boxMultifileClasses/calls to one test case; copy the two resulting tests (+ change box to main) to compileKotlinAgainstKotlin
This commit is contained in:
committed by
Alexander Udalov
parent
cc8af573f9
commit
fa1f7d988e
+23
@@ -0,0 +1,23 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
import a.*
|
||||
|
||||
fun box(): String {
|
||||
if (foo() != "OK") return "Fail function"
|
||||
if (constOK != "OK") return "Fail const"
|
||||
if (valOK != "OK") return "Fail val"
|
||||
varOK = "OK"
|
||||
if (varOK != "OK") return "Fail var"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
@file:[JvmName("MultifileClass") JvmMultifileClass]
|
||||
package a
|
||||
|
||||
fun foo(): String = "OK"
|
||||
const val constOK: String = "OK"
|
||||
val valOK: String = "OK"
|
||||
var varOK: String = "Hmmm?"
|
||||
@@ -1,12 +0,0 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
import a.foo
|
||||
|
||||
fun box(): String = foo()
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
@file:[JvmName("MultifileClass") JvmMultifileClass]
|
||||
package a
|
||||
|
||||
fun foo(): String = "OK"
|
||||
@@ -1,12 +0,0 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
import a.OK
|
||||
|
||||
fun box(): String = OK
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
@file:[JvmName("MultifileClass") JvmMultifileClass]
|
||||
package a
|
||||
|
||||
const val OK: String = "OK"
|
||||
@@ -1,12 +0,0 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
import a.OK
|
||||
|
||||
fun box(): String = OK
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
@file:[JvmName("MultifileClass") JvmMultifileClass]
|
||||
package a
|
||||
|
||||
val OK: String = "OK"
|
||||
@@ -1,15 +0,0 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
import a.OK
|
||||
|
||||
fun box(): String {
|
||||
OK = "OK"
|
||||
return OK
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
@file:[JvmName("MultifileClass") JvmMultifileClass]
|
||||
package a
|
||||
|
||||
var OK: String = "Hmmm?"
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FILE: A.kt
|
||||
|
||||
@file:[JvmName("MultifileClass") JvmMultifileClass]
|
||||
package a
|
||||
|
||||
fun foo(): String = "OK"
|
||||
const val constOK: String = "OK"
|
||||
val valOK: String = "OK"
|
||||
var varOK: String = "Hmmm?"
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import a.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (foo() != "OK") throw AssertionError("Fail function")
|
||||
if (constOK != "OK") throw AssertionError("Fail const")
|
||||
if (valOK != "OK") throw AssertionError("Fail val")
|
||||
varOK = "OK"
|
||||
if (varOK != "OK") throw AssertionError("Fail var")
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// FILE: A.kt
|
||||
|
||||
@file:[JvmName("MultifileClass") JvmMultifileClass]
|
||||
package a
|
||||
|
||||
annotation class A
|
||||
|
||||
@A
|
||||
const val OK: String = "OK"
|
||||
|
||||
// FILE: B.kt
|
||||
|
||||
import a.OK
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val okRef = ::OK
|
||||
|
||||
// TODO: see KT-10892
|
||||
// val annotations = okRef.annotations
|
||||
// val numAnnotations = annotations.size
|
||||
// if (numAnnotations != 1) {
|
||||
// throw AssertionError("Failed, annotations: $annotations")
|
||||
// }
|
||||
|
||||
val result = okRef.get()
|
||||
if (result != "OK") throw AssertionError("Fail: $result")
|
||||
}
|
||||
+151
-199
@@ -27,215 +27,167 @@ 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("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("accessorForProtected.kt")
|
||||
public void testAccessorForProtected() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtected.kt");
|
||||
doTest(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);
|
||||
}
|
||||
@TestMetadata("accessorForProtectedInvokeVirtual.kt")
|
||||
public void testAccessorForProtectedInvokeVirtual() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/accessorForProtectedInvokeVirtual.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
public void testAllFilesPresentInBoxMultiFile() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxMultiFile"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("callFromOtherPackage.kt")
|
||||
public void testCallFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/callFromOtherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
@TestMetadata("callMultifileClassMemberFromOtherPackage.kt")
|
||||
public void testCallMultifileClassMemberFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/callMultifileClassMemberFromOtherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constFromOtherPackage.kt")
|
||||
public void testConstFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/constFromOtherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
@TestMetadata("callsToMultifileClassFromOtherPackage.kt")
|
||||
public void testCallsToMultifileClassFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/callsToMultifileClassFromOtherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("valFromOtherPackage.kt")
|
||||
public void testValFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/valFromOtherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
@TestMetadata("constPropertyReferenceFromMultifileClass.kt")
|
||||
public void testConstPropertyReferenceFromMultifileClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/constPropertyReferenceFromMultifileClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("varFromOtherPackage.kt")
|
||||
public void testVarFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/calls/varFromOtherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
@TestMetadata("inlineMultifileClassMemberFromOtherPackage.kt")
|
||||
public void testInlineMultifileClassMemberFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/inlineMultifileClassMemberFromOtherPackage.kt");
|
||||
doTest(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("internalVisibility.kt")
|
||||
public void testInternalVisibility() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/internalVisibility.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constPropertyReferenceFromMultifileClass.kt")
|
||||
public void testConstPropertyReferenceFromMultifileClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxMultifileClasses/reflection/constPropertyReferenceFromMultifileClass.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);
|
||||
}
|
||||
}
|
||||
|
||||
+51
@@ -16,10 +16,61 @@
|
||||
|
||||
package org.jetbrains.kotlin.jvm.compiler
|
||||
|
||||
import org.jetbrains.kotlin.codegen.ClassFileFactory
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestCase
|
||||
import org.jetbrains.kotlin.codegen.InlineTestUtil
|
||||
import org.jetbrains.kotlin.codegen.filterClassFiles
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractCompileKotlinAgainstInlineKotlinTest : AbstractCompileKotlinAgainstKotlinTest(), AbstractSMAPBaseTest {
|
||||
protected fun doBoxTest(firstFileName: String): Pair<ClassFileFactory, ClassFileFactory> {
|
||||
var files: List<CodegenTestCase.TestFile> = KotlinTestUtils.createTestFiles(
|
||||
firstFileName, KotlinTestUtils.doLoadFile(File(firstFileName)),
|
||||
object : KotlinTestUtils.TestFileFactory<Unit, CodegenTestCase.TestFile> {
|
||||
override fun createFile(
|
||||
module: Unit?, fileName: String, text: String, directives: Map<String, String>
|
||||
): CodegenTestCase.TestFile {
|
||||
return CodegenTestCase.TestFile(fileName, text)
|
||||
}
|
||||
|
||||
override fun createModule(name: String, dependencies: List<String>) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
})
|
||||
|
||||
// TODO: drop this (migrate codegen/box/inline/)
|
||||
if (files.size == 1) {
|
||||
val firstFile = files.iterator().next()
|
||||
val secondFile = File(firstFileName.replace("1.kt", "2.kt"))
|
||||
files = listOf(firstFile, CodegenTestCase.TestFile(secondFile.name, KotlinTestUtils.doLoadFile(secondFile)))
|
||||
}
|
||||
|
||||
var factory1: ClassFileFactory? = null
|
||||
var factory2: ClassFileFactory? = null
|
||||
try {
|
||||
val fileA = files[1]
|
||||
val fileB = files[0]
|
||||
factory1 = compileA(fileA.name, fileA.content)
|
||||
factory2 = compileB(fileB.name, fileB.content)
|
||||
invokeBox(PackagePartClassUtils.getFilePartShortName(File(fileB.name).name))
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
var result = ""
|
||||
if (factory1 != null) {
|
||||
result += "FIRST: \n\n" + factory1.createText()
|
||||
}
|
||||
if (factory2 != null) {
|
||||
result += "\n\nSECOND: \n\n" + factory2.createText()
|
||||
}
|
||||
println(result)
|
||||
throw e
|
||||
}
|
||||
|
||||
return Pair(factory1, factory2)
|
||||
}
|
||||
|
||||
fun doBoxTestWithInlineCheck(firstFileName: String) {
|
||||
val (factory1, factory2) = doBoxTest(firstFileName)
|
||||
val allGeneratedFiles = factory1.asList() + factory2.asList()
|
||||
|
||||
+3
-56
@@ -19,9 +19,7 @@ package org.jetbrains.kotlin.jvm.compiler;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import kotlin.Pair;
|
||||
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;
|
||||
@@ -37,14 +35,12 @@ import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestJdkKind;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -80,7 +76,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
|
||||
main.invoke(null, new Object[] {ArrayUtil.EMPTY_STRING_ARRAY});
|
||||
}
|
||||
|
||||
private void invokeBox(@NotNull String className) throws Exception {
|
||||
protected void invokeBox(@NotNull String className) throws Exception {
|
||||
Method box = createGeneratedClassLoader().loadClass(className).getMethod("box");
|
||||
String result = (String) box.invoke(null);
|
||||
assertEquals("OK", result);
|
||||
@@ -95,14 +91,14 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ClassFileFactory compileA(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||
protected ClassFileFactory compileA(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||
KotlinCoreEnvironment environment =
|
||||
KotlinTestUtils.createEnvironmentWithMockJdkAndIdeaAnnotations(getTestRootDisposable(), ConfigurationKind.ALL);
|
||||
return compileKotlin(fileName, content, aDir, environment, getTestRootDisposable());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ClassFileFactory compileB(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||
protected ClassFileFactory compileB(@NotNull String fileName, @NotNull String content) throws IOException {
|
||||
CompilerConfiguration configurationWithADirInClasspath = KotlinTestUtils
|
||||
.compilerConfigurationForTests(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar(), aDir);
|
||||
|
||||
@@ -128,53 +124,4 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
|
||||
Disposer.dispose(disposable);
|
||||
return outputFiles;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
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 {
|
||||
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 = "";
|
||||
if (factory1 != null) {
|
||||
result += "FIRST: \n\n" + factory1.createText();
|
||||
}
|
||||
if (factory2 != null) {
|
||||
result += "\n\nSECOND: \n\n" + factory2.createText();
|
||||
}
|
||||
System.out.println(result);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
|
||||
return new Pair<ClassFileFactory, ClassFileFactory>(factory1, factory2);
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -41,6 +41,12 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("callsToMultifileClassFromOtherPackage.kt")
|
||||
public void testCallsToMultifileClassFromOtherPackage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/callsToMultifileClassFromOtherPackage.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classInObject.kt")
|
||||
public void testClassInObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/classInObject.kt");
|
||||
@@ -59,6 +65,12 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constPropertyReferenceFromMultifileClass.kt")
|
||||
public void testConstPropertyReferenceFromMultifileClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/constPropertyReferenceFromMultifileClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorVararg.kt")
|
||||
public void testConstructorVararg() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/constructorVararg.kt");
|
||||
|
||||
-85
@@ -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 CompileKotlinAgainstMultifileKotlinTestGenerated extends AbstractCompileKotlinAgainstKotlinTest {
|
||||
public void testAllFilesPresentInBoxMultifileClasses() throws Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -203,13 +203,8 @@ fun main(args: Array<String>) {
|
||||
model("codegen/boxInline", extension = "1.kt", testMethod = "doBoxTestWithInlineCheck")
|
||||
}
|
||||
|
||||
testClass<AbstractCompileKotlinAgainstKotlinTest>("CompileKotlinAgainstMultifileKotlinTestGenerated") {
|
||||
model("codegen/boxMultifileClasses", testMethod = "doBoxTest")
|
||||
}
|
||||
|
||||
testClass<AbstractBlackBoxCodegenTest>("BlackBoxMultiFileCodegenTestGenerated") {
|
||||
model("codegen/boxMultiFile")
|
||||
model("codegen/boxMultifileClasses")
|
||||
}
|
||||
|
||||
testClass<AbstractBlackBoxCodegenTest>("BlackBoxAgainstJavaCodegenTestGenerated") {
|
||||
|
||||
Reference in New Issue
Block a user