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
@@ -0,0 +1,38 @@
// FILE: 1.kt
import b.B
import a.BSamePackage
fun box() = if (B().test() == BSamePackage().test()) "OK" else "fail"
// FILE: 2.kt
package a
open class A {
protected fun protectedFun(): String = "OK"
}
class BSamePackage: A() {
fun test(): String {
val a = {
protectedFun()
}
return a()
}
}
// FILE: 3.kt
package b
import a.A
class B: A() {
fun test(): String {
val a = {
protectedFun()
}
return a()
}
}
@@ -1,4 +0,0 @@
import b.B
import a.BSamePackage
fun box() = if (B().test() == BSamePackage().test()) "OK" else "fail"
@@ -1,14 +0,0 @@
package a
open class A {
protected fun protectedFun(): String = "OK"
}
class BSamePackage: A() {
fun test(): String {
val a = {
protectedFun()
}
return a()
}
}
@@ -1,12 +0,0 @@
package b
import a.A
class B: A() {
fun test(): String {
val a = {
protectedFun()
}
return a()
}
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
import test.A
import kotlin.test.assertEquals
@@ -47,3 +49,19 @@ class C : B() {
}
fun box() = C().box()
// FILE: 2.kt
package test
abstract class A {
public var state = ""
// These implementations should not be called, because they are overridden in C
protected open fun method(): String = "A.method"
protected open var property: String
get() = "A.property"
set(value) { state += "A.property;" }
}
@@ -1,13 +0,0 @@
package test
abstract class A {
public var state = ""
// These implementations should not be called, because they are overridden in C
protected open fun method(): String = "A.method"
protected open var property: String
get() = "A.property"
set(value) { state += "A.property;" }
}
@@ -0,0 +1,22 @@
// FILE: box.kt
package test
import b.bar
fun box(): String = bar()
// FILE: caller.kt
package b
import a.foo
fun bar(): String = foo()
// FILE: multifileClass.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
fun foo(): String = "OK"
@@ -1,5 +0,0 @@
package test
import b.bar
fun box(): String = bar()
@@ -1,5 +0,0 @@
package b
import a.foo
fun bar(): String = foo()
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
fun foo(): String = "OK"
@@ -0,0 +1,21 @@
// FILE: box.kt
package test
import a.foo
fun box(): String = foo { "OK" }
// FILE: foo.kt
@file:[JvmName("A") JvmMultifileClass]
package a
inline fun foo(body: () -> String): String = zee(body())
// FILE: zee.kt
@file:[JvmName("A") JvmMultifileClass]
package a
public fun zee(x: String): String = x
@@ -1,5 +0,0 @@
package test
import a.foo
fun box(): String = foo { "OK" }
@@ -1,4 +0,0 @@
@file:[JvmName("A") JvmMultifileClass]
package a
inline fun foo(body: () -> String): String = zee(body())
@@ -1,4 +0,0 @@
@file:[JvmName("A") JvmMultifileClass]
package a
public fun zee(x: String): String = x
@@ -0,0 +1,9 @@
// FILE: 1.kt
fun box() = a.x
// FILE: 2.kt
package a
val x: String = "OK"
@@ -1 +0,0 @@
fun box() = a.x
@@ -1,3 +0,0 @@
package a
val x: String = "OK"
@@ -1,3 +1,5 @@
// FILE: a.kt
package test2
import test.Actor
@@ -17,4 +19,18 @@ fun box(): String {
if (O2dDialog().test2() != null) return "fail 2"
return "OK"
}
}
// FILE: b.kt
package test
open class Actor
abstract public class O2dScriptAction<T : Actor> {
protected var owner: T? = null
private set
protected fun calc(): T? = null
}
-11
View File
@@ -1,11 +0,0 @@
package test
open class Actor
abstract public class O2dScriptAction<T : Actor> {
protected var owner: T? = null
private set
protected fun calc(): T? = null
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package thispackage
import otherpackage.*
@@ -15,4 +17,13 @@ fun box(): String {
fun localUse(): Boolean {
val c = Runnable::class.java
return (c.getName()!! == "java.lang.Runnable")
}
}
// FILE: 2.kt
package otherpackage
fun fromOtherPackage(): Boolean {
val c = Runnable::class.java
return (c.getName()!! == "java.lang.Runnable")
}
-6
View File
@@ -1,6 +0,0 @@
package otherpackage
fun fromOtherPackage(): Boolean {
val c = Runnable::class.java
return (c.getName()!! == "java.lang.Runnable")
}
@@ -1,4 +1,10 @@
// FILE: 1.kt
fun box() = foo()
// FILE: 2.kt
private val a = "OK"
fun foo() : String {
return "${a}"
}
}
-1
View File
@@ -1 +0,0 @@
fun box() = foo()
@@ -1,6 +1,12 @@
// FILE: 1.kt
public var v1: String = "V1"
fun box(): String {
val s = "v1: $v1, v2: $v2"
return "OK"
}
// FILE: 2.kt
public var v2: String = "V2"
-1
View File
@@ -1 +0,0 @@
public var v2: String = "V2"
@@ -1,3 +1,20 @@
// FILE: 1.kt
import testing.ClassWithInternals
public class HelloServer() : ClassWithInternals() {
public override fun start() {
val test = foo() + someGetter //+ some
}
}
fun box() : String {
HelloServer().start()
return "OK"
}
// FILE: 2.kt
package testing; // There is no error if both files are in default package
public abstract class ClassWithInternals {
-12
View File
@@ -1,12 +0,0 @@
import testing.ClassWithInternals
public class HelloServer() : ClassWithInternals() {
public override fun start() {
val test = foo() + someGetter //+ some
}
}
fun box() : String {
HelloServer().start()
return "OK"
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test2
import test.A
@@ -13,4 +15,12 @@ public class B : A() {
}
return "fail"
}
}
}
// FILE: 2.kt
package test
open class A {
@JvmField protected val s = 2;
}
-5
View File
@@ -1,5 +0,0 @@
package test
open class A {
@JvmField protected val s = 2;
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test2
import test.A
@@ -11,3 +13,11 @@ class C : A() {
public fun box(): String {
return C().a()
}
// FILE: 2.kt
package test
open class A {
@JvmField protected val s = "OK";
}
-5
View File
@@ -1,5 +0,0 @@
package test
open class A {
@JvmField protected val s = "OK";
}
+12
View File
@@ -0,0 +1,12 @@
// FILE: box.kt
object Test {
val test: String = OK
}
fun box(): String = Test.test
// FILE: Vars.kt
public var OK: String = "OK"
private set
-2
View File
@@ -1,2 +0,0 @@
public var OK: String = "OK"
private set
-5
View File
@@ -1,5 +0,0 @@
object Test {
val test: String = OK
}
fun box(): String = Test.test
@@ -1,3 +1,16 @@
// FILE: a.kt
package a
import b.*
fun box(): String {
BB().ok()
return BB().OK
}
// FILE: b.kt
package b
public open class B {
@@ -7,4 +20,4 @@ public open class B {
public class BB : B() {
public fun ok(): String = OK
}
}
@@ -1,8 +0,0 @@
package a
import b.*
fun box(): String {
BB().ok()
return BB().OK
}
@@ -1,3 +1,5 @@
// FILE: a.kt
package a
import b.*
@@ -13,4 +15,16 @@ class B {
fun box(): String {
B()
return result
}
}
// FILE: b.kt
package b
var result = "fail"
abstract class A {
protected fun foo() {
result = "OK"
}
}
-9
View File
@@ -1,9 +0,0 @@
package b
var result = "fail"
abstract class A {
protected fun foo() {
result = "OK"
}
}
@@ -1,3 +1,5 @@
// FILE: a.kt
package a
import b.*
@@ -15,4 +17,16 @@ class C : B
fun box(): String {
C().test()
return result
}
}
// FILE: b.kt
package b
var result = "fail"
abstract class A {
protected fun foo() {
result = "OK"
}
}
@@ -1,9 +0,0 @@
package b
var result = "fail"
abstract class A {
protected fun foo() {
result = "OK"
}
}
@@ -1,3 +1,5 @@
// FILE: 1.kt
package test
class A {}
@@ -19,3 +21,20 @@ fun box(): String {
return args[0]
}
// FILE: a.kt
package pkg
fun main(args: Array<String>) {
args[0] += "O"
}
// FILE: b.kt
package pkg
fun main(args: Array<String>) {
args[0] += "K"
}
@@ -1,5 +0,0 @@
package pkg
fun main(args: Array<String>) {
args[0] += "O"
}
@@ -1,5 +0,0 @@
package pkg
fun main(args: Array<String>) {
args[0] += "K"
}
@@ -0,0 +1,26 @@
// FILE: box.kt
import a.*
fun box(): String = OK
// FILE: part1.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val O: String = "O"
// FILE: part2.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val K: String = "K"
// FILE: part3.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val OK: String = O + K
@@ -1,3 +0,0 @@
import a.*
fun box(): String = OK
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val O: String = "O"
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val K: String = "K"
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val OK: String = O + K
@@ -0,0 +1,24 @@
// FILE: box.kt
package a
import pack.*
class X : SomeClass()
fun box(): String {
X()
return "OK"
}
// FILE: file1.kt
package kotlin.jvm
private class SomeClass
// FILE: file2.kt
package pack
public open class SomeClass
@@ -1,10 +0,0 @@
package a
import pack.*
class X : SomeClass()
fun box(): String {
X()
return "OK"
}
@@ -1,3 +0,0 @@
package kotlin.jvm
private class SomeClass
@@ -1,3 +0,0 @@
package pack
public open class SomeClass
@@ -1,4 +1,15 @@
// B.kt
// FILE: A.kt
package first
open class A {
protected open fun test(): String = "FAIL (A)"
}
fun box() = second.C().value()
// FILE: B.kt
// See also KT-8344: INVOKESPECIAL instead of INVOKEVIRTUAL in accessor
package second
@@ -14,4 +25,3 @@ public abstract class B(): A() {
class C: B() {
override fun test() = "OK"
}
@@ -1,8 +0,0 @@
// A.kt
package first
open class A {
protected open fun test(): String = "FAIL (A)"
}
fun box() = second.C().value()
@@ -0,0 +1,22 @@
// FILE: 1/wrapped.kt
fun getWrapped1(): Runnable {
val f = { }
return Runnable(f)
}
// FILE: 2/wrapped2.kt
fun getWrapped2(): Runnable {
val f = { }
return Runnable(f)
}
// FILE: box.kt
fun box(): String {
val class1 = getWrapped1().javaClass
val class2 = getWrapped2().javaClass
return if (class1 != class2) "OK" else "Same class: $class1"
}
@@ -1,4 +0,0 @@
fun getWrapped1(): Runnable {
val f = { }
return Runnable(f)
}
@@ -1,4 +0,0 @@
fun getWrapped2(): Runnable {
val f = { }
return Runnable(f)
}
@@ -1,6 +0,0 @@
fun box(): String {
val class1 = getWrapped1().javaClass
val class2 = getWrapped2().javaClass
return if (class1 != class2) "OK" else "Same class: $class1"
}
@@ -0,0 +1,7 @@
// FILE: 1/box.kt
fun box() = box1() + "K"
// FILE: 2/box2.kt
fun box1() = "O"
@@ -1 +0,0 @@
fun box() = box1() + "K"
@@ -1 +0,0 @@
fun box1() = "O"
@@ -0,0 +1,21 @@
// FILE: 1/part.kt
@file:JvmName("Foo")
@file:JvmMultifileClass
package test
fun foo(): String = "O"
// FILE: 2/part.kt
@file:JvmName("Bar")
@file:JvmMultifileClass
package test
fun bar(): String = "K"
// FILE: box.kt
package test
fun box(): String = foo() + bar()
@@ -1,5 +0,0 @@
@file:JvmName("Foo")
@file:JvmMultifileClass
package test
fun foo(): String = "O"
@@ -1,5 +0,0 @@
@file:JvmName("Bar")
@file:JvmMultifileClass
package test
fun bar(): String = "K"
@@ -1,3 +0,0 @@
package test
fun box(): String = foo() + bar()
+7
View File
@@ -0,0 +1,7 @@
// FILE: 1.kt
fun box() = ok()
// FILE: 2.kt
fun ok(res: String = "OK") = res
-1
View File
@@ -1 +0,0 @@
fun box() = ok()
-1
View File
@@ -1 +0,0 @@
fun ok(res: String = "OK") = res
@@ -1,3 +0,0 @@
import a.foo
fun box(): String = foo()
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
fun foo(): String = "OK"
@@ -0,0 +1,12 @@
// FILE: 1.kt
import a.foo
fun box(): String = foo()
// FILE: 2.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
fun foo(): String = "OK"
@@ -1,3 +0,0 @@
import a.OK
fun box(): String = OK
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
const val OK: String = "OK"
@@ -0,0 +1,12 @@
// 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,3 +0,0 @@
import a.OK
fun box(): String = OK
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val OK: String = "OK"
@@ -0,0 +1,12 @@
// FILE: 1.kt
import a.OK
fun box(): String = OK
// FILE: 2.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
val OK: String = "OK"
@@ -1,6 +0,0 @@
import a.OK
fun box(): String {
OK = "OK"
return OK
}
@@ -1,4 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
var OK: String = "Hmmm?"
@@ -0,0 +1,15 @@
// 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?"
@@ -1,7 +0,0 @@
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
annotation class A
@A
const val OK: String = "OK"
@@ -1,9 +1,11 @@
// FILE: 1.kt
import a.OK
fun box(): String {
val okRef = ::OK
// TODO
// TODO: see KT-10892
// val annotations = okRef.annotations
// val numAnnotations = annotations.size
// if (numAnnotations != 1) {
@@ -11,4 +13,14 @@ fun box(): String {
// }
return okRef.get()
}
}
// FILE: 2.kt
@file:[JvmName("MultifileClass") JvmMultifileClass]
package a
annotation class A
@A
const val OK: String = "OK"
@@ -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);
}
}
}
@@ -203,16 +203,13 @@ fun main(args: Array<String>) {
model("codegen/boxInline", extension = "1.kt", testMethod = "doBoxTestWithInlineCheck")
}
testClass(AbstractBlackBoxMultifileClassCodegenTest::class.java, "BlackBoxMultifileClassKotlinTestGenerated") {
model("codegen/boxMultifileClasses", extension = "1.kt", testMethod = "doTestMultifileClassAgainstSources")
}
testClass(AbstractCompileKotlinAgainstMultifileKotlinTest::class.java, "CompileKotlinAgainstMultifileKotlinTestGenerated") {
model("codegen/boxMultifileClasses", extension = "1.kt", testMethod = "doBoxTest")
}
testClass<AbstractBlackBoxCodegenTest>("BlackBoxMultiFileCodegenTestGenerated") {
model("codegen/boxMultiFile", extension = null, recursive = false, testMethod = "doTestMultiFile")
model("codegen/boxMultiFile")
model("codegen/boxMultifileClasses")
}
testClass<AbstractBlackBoxCodegenTest>("BlackBoxAgainstJavaCodegenTestGenerated") {