From 9e9f593a7f4a891353ed826f871317ac392426da Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Wed, 14 Oct 2015 16:47:50 +0300 Subject: [PATCH] Generate tests for ide light classes from the same test data as for compiler light classes --- .../lightClasses/delegation/Function.java | 2 +- .../lightClasses/delegation/Function.kt | 2 +- .../nullabilityAnnotations/JvmOverloads.java | 2 +- .../nullabilityAnnotations/JvmOverloads.kt | 4 +- .../PrivateInClass.java | 2 +- .../nullabilityAnnotations/PrivateInClass.kt | 2 +- .../nullabilityAnnotations/VoidReturn.java | 2 +- .../nullabilityAnnotations/VoidReturn.kt | 2 +- .../AbstractCompilerLightClassTest.java | 41 +--- .../kotlin/asJava/LightClassTestCommon.kt | 53 +++++ .../kotlin/generators/tests/GenerateTests.kt | 7 + .../resolve/AbstractIdeLightClassTest.kt | 46 ++++ .../resolve/IdeLightClassTestGenerated.java | 223 ++++++++++++++++++ 13 files changed, 351 insertions(+), 37 deletions(-) create mode 100644 compiler/tests/org/jetbrains/kotlin/asJava/LightClassTestCommon.kt create mode 100644 idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt create mode 100644 idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeLightClassTestGenerated.java diff --git a/compiler/testData/asJava/lightClasses/delegation/Function.java b/compiler/testData/asJava/lightClasses/delegation/Function.java index c6d4fbde337..c184f995c0d 100644 --- a/compiler/testData/asJava/lightClasses/delegation/Function.java +++ b/compiler/testData/asJava/lightClasses/delegation/Function.java @@ -2,5 +2,5 @@ public final class Derived implements Base { public Derived(@org.jetbrains.annotations.NotNull Base x) { /* compiled code */ } @org.jetbrains.annotations.NotNull - public java.lang.String baz(@org.jetbrains.annotations.NotNull java.lang.String s) { /* compiled code */ } + public java.lang.String baz(@org.jetbrains.annotations.NotNull java.lang.String g) { /* compiled code */ } } \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/delegation/Function.kt b/compiler/testData/asJava/lightClasses/delegation/Function.kt index 2b0a72c3c32..101fd1907ba 100644 --- a/compiler/testData/asJava/lightClasses/delegation/Function.kt +++ b/compiler/testData/asJava/lightClasses/delegation/Function.kt @@ -1,7 +1,7 @@ // Derived interface Base { - fun baz(s: String): String + fun baz(g: String): String } class Derived(x: Base): Base by x \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java index 14d3ce8cfaf..82eaf50d61a 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.java @@ -1,7 +1,7 @@ public final class C { @kotlin.jvm.JvmOverloads @org.jetbrains.annotations.NotNull - public final java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String o, @org.jetbrains.annotations.NotNull java.lang.String s1, @org.jetbrains.annotations.NotNull java.lang.String k, @org.jetbrains.annotations.Nullable java.lang.String s2) { /* compiled code */ } + public final java.lang.String foo(@org.jetbrains.annotations.NotNull java.lang.String o, @org.jetbrains.annotations.NotNull java.lang.String o1, @org.jetbrains.annotations.NotNull java.lang.String o3, @org.jetbrains.annotations.Nullable java.lang.String o4) { /* compiled code */ } @kotlin.jvm.JvmOverloads @org.jetbrains.annotations.NotNull diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt index 09d2e4fb3c1..c38e5e1079b 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt @@ -1,7 +1,7 @@ // C class C { - @[kotlin.jvm.JvmOverloads] public fun foo(o: String = "O", s1: String, k: String = "K", s2: String?): String { - return o + k + @[kotlin.jvm.JvmOverloads] public fun foo(o: String = "O", o1: String, o3: String = "K", o4: String?): String { + return "a" } } diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.java b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.java index 2856f43710e..2066732fe31 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.java +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.java @@ -7,5 +7,5 @@ public final class PrivateInClass { private final java.lang.String bar(java.lang.String a, java.lang.String b) { /* compiled code */ } - private PrivateInClass(java.lang.String s) { /* compiled code */ } + private PrivateInClass(java.lang.String g) { /* compiled code */ } } diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.kt b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.kt index 001ebfced08..c970f2ac5e0 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.kt +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.kt @@ -1,6 +1,6 @@ // PrivateInClass -class PrivateInClass private (s: String?) { +class PrivateInClass private (g: String?) { private var nn: String get() = "" set(value) {} diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.java b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.java index 81a63ae9c0f..032705fef7e 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.java +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.java @@ -4,5 +4,5 @@ @java.lang.Deprecated public final class _DefaultPackage { @kotlin.jvm.internal.KotlinDelegatedMethod(implementationClassName = "VoidReturnKt") - public static final void foo(@org.jetbrains.annotations.NotNull java.lang.String s) { /* compiled code */ } + public static final void foo(@org.jetbrains.annotations.NotNull java.lang.String g) { /* compiled code */ } } \ No newline at end of file diff --git a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.kt b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.kt index 4d2cdda1da3..c2e5b586d2b 100644 --- a/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.kt +++ b/compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.kt @@ -1,3 +1,3 @@ // _DefaultPackage -fun foo(s: String) {} \ No newline at end of file +fun foo(g: String) {} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.java b/compiler/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.java index 29962756107..506150a7abf 100644 --- a/compiler/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.java +++ b/compiler/tests/org/jetbrains/kotlin/asJava/AbstractCompilerLightClassTest.java @@ -16,10 +16,9 @@ package org.jetbrains.kotlin.asJava; -import com.intellij.openapi.util.io.FileUtil; import com.intellij.psi.PsiClass; -import com.intellij.psi.impl.compiled.ClsElementImpl; import com.intellij.psi.search.GlobalSearchScope; +import kotlin.jvm.functions.Function1; import org.jetbrains.annotations.NotNull; import org.jetbrains.kotlin.checkers.KotlinMultiFileTestWithWithJava; import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment; @@ -27,18 +26,15 @@ import org.jetbrains.kotlin.config.CompilerConfiguration; import org.jetbrains.kotlin.test.ConfigurationKind; import org.jetbrains.kotlin.test.JetTestUtils; import org.jetbrains.kotlin.test.TestJdkKind; +import org.jetbrains.kotlin.utils.ExceptionUtilsKt; import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; public abstract class AbstractCompilerLightClassTest extends KotlinMultiFileTestWithWithJava { - private static final Pattern SUBJECT_FQ_NAME_PATTERN = Pattern.compile("^//\\s*(.*)$", Pattern.MULTILINE); - @Override @NotNull protected CompilerConfiguration createCompilerConfiguration(File javaFilesDir) { @@ -66,28 +62,17 @@ public abstract class AbstractCompilerLightClassTest extends KotlinMultiFileTest @Override protected void doMultiFileTest(File file, Map modules, List files) throws IOException { - String text = FileUtil.loadFile(file, true); - Matcher matcher = SUBJECT_FQ_NAME_PATTERN.matcher(text); - assertTrue("No FqName specified. First line of the form '// f.q.Name' expected", matcher.find()); - String fqName = matcher.group(1); - - JavaElementFinder finder = createFinder(getEnvironment()); - - PsiClass psiClass = finder.findClass(fqName, GlobalSearchScope.allScope(getEnvironment().getProject())); - if (!(psiClass instanceof KotlinLightClass)) { - throw new IllegalStateException("Not a light class: " + psiClass + " (" + fqName + ")"); - } - - PsiClass delegate = ((KotlinLightClass) psiClass).getDelegate(); - if (!(delegate instanceof ClsElementImpl)) { - throw new IllegalStateException("Not a CLS element: " + delegate); - } - - StringBuilder buffer = new StringBuilder(); - ((ClsElementImpl) delegate).appendMirrorText(0, buffer); - String actual = buffer.toString(); - - JetTestUtils.assertEqualsToFile(JetTestUtils.replaceExtension(file, "java"), actual); + LightClassTestCommon.INSTANCE.testLightClass(file, new Function1() { + @Override + public PsiClass invoke(String s) { + try { + return createFinder(getEnvironment()).findClass(s, GlobalSearchScope.allScope(getEnvironment().getProject())); + } + catch (IOException e) { + throw ExceptionUtilsKt.rethrow(e); + } + } + }); } @Override diff --git a/compiler/tests/org/jetbrains/kotlin/asJava/LightClassTestCommon.kt b/compiler/tests/org/jetbrains/kotlin/asJava/LightClassTestCommon.kt new file mode 100644 index 00000000000..264ba4f726e --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/asJava/LightClassTestCommon.kt @@ -0,0 +1,53 @@ +/* + * 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.asJava + +import com.intellij.openapi.util.io.FileUtil +import com.intellij.psi.PsiClass +import com.intellij.psi.impl.compiled.ClsElementImpl +import junit.framework.TestCase +import org.jetbrains.kotlin.test.JetTestUtils +import java.io.File +import java.util.regex.Pattern + +object LightClassTestCommon { + private val SUBJECT_FQ_NAME_PATTERN = Pattern.compile("^//\\s*(.*)$", Pattern.MULTILINE) + + @JvmOverloads + fun testLightClass( + testDataFile: File, + findLightClass: (String) -> PsiClass?, + normalizeText: (String) -> String = { it } + ) { + val text = FileUtil.loadFile(testDataFile, true) + val matcher = SUBJECT_FQ_NAME_PATTERN.matcher(text) + TestCase.assertTrue("No FqName specified. First line of the form '// f.q.Name' expected", matcher.find()) + val fqName = matcher.group(1) + + val lightClass = findLightClass(fqName) + + TestCase.assertTrue("Not a light class: $lightClass ($fqName)", lightClass is KotlinLightClass) + + val delegate = (lightClass as KotlinLightClass).getDelegate() + TestCase.assertTrue("Not a CLS element: $delegate", delegate is ClsElementImpl) + + val buffer = StringBuilder() + (delegate as ClsElementImpl).appendMirrorText(0, buffer) + val actual = normalizeText(buffer.toString()) + JetTestUtils.assertEqualsToFile(JetTestUtils.replaceExtension(testDataFile, "java"), actual) + } +} \ No newline at end of file diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 0220a5319a6..299645fcf9c 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -42,6 +42,7 @@ import org.jetbrains.kotlin.generators.tests.reservedWords.generateTestDataForRe import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest import org.jetbrains.kotlin.idea.actions.AbstractGotoTestOrCodeActionTest +import org.jetbrains.kotlin.idea.caches.resolve.AbstractIdeLightClassTest import org.jetbrains.kotlin.idea.codeInsight.* import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateActionTest import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest @@ -747,6 +748,12 @@ fun main(args: Array) { } } + testGroup("idea/tests", "compiler/testData") { + testClass() { + model("asJava/lightClasses", excludeDirs = listOf("delegation")) + } + } + testGroup("idea/idea-completion/tests", "idea/idea-completion/testData") { testClass() { model("injava", extension = "java") diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt new file mode 100644 index 00000000000..4d4d9c1c8ab --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/AbstractIdeLightClassTest.kt @@ -0,0 +1,46 @@ +/* + * 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.idea.caches.resolve + +import com.intellij.psi.JavaPsiFacade +import com.intellij.psi.search.GlobalSearchScope +import org.jetbrains.kotlin.asJava.LightClassTestCommon +import org.jetbrains.kotlin.idea.test.JetLightCodeInsightFixtureTestCase +import org.jetbrains.kotlin.idea.test.JetWithJdkAndRuntimeLightProjectDescriptor +import java.io.File + +abstract class AbstractIdeLightClassTest : JetLightCodeInsightFixtureTestCase() { + + fun doTest(testDataPath: String) { + myFixture.configureByFile(testDataPath) + + val project = project + LightClassTestCommon.testLightClass( + File(testDataPath), + findLightClass = { + JavaPsiFacade.getInstance(project).findClass(it, GlobalSearchScope.allScope(project)) + }, + normalizeText = { + //NOTE: ide and compiler differ in names generated for parameters with unspecified names + it.replace("java.lang.String s,", "java.lang.String p,").replace("java.lang.String s)", "java.lang.String p)") + .replace("java.lang.String s1", "java.lang.String p1").replace("java.lang.String s2", "java.lang.String p2") + } + ) + } + + override fun getProjectDescriptor() = JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeLightClassTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeLightClassTestGenerated.java new file mode 100644 index 00000000000..662673bc151 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeLightClassTestGenerated.java @@ -0,0 +1,223 @@ +/* + * 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.idea.caches.resolve; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.JetTestUtils; +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/asJava/lightClasses") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class IdeLightClassTestGenerated extends AbstractIdeLightClassTest { + public void testAllFilesPresentInLightClasses() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^(.+)\\.kt$"), true, "delegation"); + } + + @TestMetadata("compiler/testData/asJava/lightClasses/facades") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Facades extends AbstractIdeLightClassTest { + public void testAllFilesPresentInFacades() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("SingleFile.kt") + public void testSingleFile() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/facades/SingleFile.kt"); + doTest(fileName); + } + + @TestMetadata("SingleJvmClassName.kt") + public void testSingleJvmClassName() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/facades/SingleJvmClassName.kt"); + doTest(fileName); + } + } + + @TestMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NullabilityAnnotations extends AbstractIdeLightClassTest { + public void testAllFilesPresentInNullabilityAnnotations() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/nullabilityAnnotations"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("Class.kt") + public void testClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Class.kt"); + doTest(fileName); + } + + @TestMetadata("ClassObjectField.kt") + public void testClassObjectField() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/ClassObjectField.kt"); + doTest(fileName); + } + + @TestMetadata("ClassWithConstructor.kt") + public void testClassWithConstructor() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/ClassWithConstructor.kt"); + doTest(fileName); + } + + @TestMetadata("ClassWithConstructorAndProperties.kt") + public void testClassWithConstructorAndProperties() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/ClassWithConstructorAndProperties.kt"); + doTest(fileName); + } + + @TestMetadata("Generic.kt") + public void testGeneric() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Generic.kt"); + doTest(fileName); + } + + @TestMetadata("IntOverridesAny.kt") + public void testIntOverridesAny() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/IntOverridesAny.kt"); + doTest(fileName); + } + + @TestMetadata("JvmOverloads.kt") + public void testJvmOverloads() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/JvmOverloads.kt"); + doTest(fileName); + } + + @TestMetadata("NullableUnitReturn.kt") + public void testNullableUnitReturn() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/NullableUnitReturn.kt"); + doTest(fileName); + } + + @TestMetadata("OverrideAnyWithUnit.kt") + public void testOverrideAnyWithUnit() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/OverrideAnyWithUnit.kt"); + doTest(fileName); + } + + @TestMetadata("PlatformTypes.kt") + public void testPlatformTypes() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PlatformTypes.kt"); + doTest(fileName); + } + + @TestMetadata("Primitives.kt") + public void testPrimitives() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Primitives.kt"); + doTest(fileName); + } + + @TestMetadata("PrivateInClass.kt") + public void testPrivateInClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInClass.kt"); + doTest(fileName); + } + + @TestMetadata("PrivateInTrait.kt") + public void testPrivateInTrait() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInTrait.kt"); + doTest(fileName); + } + + @TestMetadata("Synthetic.kt") + public void testSynthetic() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Synthetic.kt"); + doTest(fileName); + } + + @TestMetadata("Trait.kt") + public void testTrait() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/Trait.kt"); + doTest(fileName); + } + + @TestMetadata("TraitClassObjectField.kt") + public void testTraitClassObjectField() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/TraitClassObjectField.kt"); + doTest(fileName); + } + + @TestMetadata("UnitAsGenericArgument.kt") + public void testUnitAsGenericArgument() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/UnitAsGenericArgument.kt"); + doTest(fileName); + } + + @TestMetadata("UnitParameter.kt") + public void testUnitParameter() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/UnitParameter.kt"); + doTest(fileName); + } + + @TestMetadata("VoidReturn.kt") + public void testVoidReturn() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/VoidReturn.kt"); + doTest(fileName); + } + + @TestMetadata("_DefaultPackage.kt") + public void test_DefaultPackage() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/_DefaultPackage.kt"); + doTest(fileName); + } + } + + @TestMetadata("compiler/testData/asJava/lightClasses/object") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Object extends AbstractIdeLightClassTest { + public void testAllFilesPresentInObject() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/object"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("SimpleObject.kt") + public void testSimpleObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/object/SimpleObject.kt"); + doTest(fileName); + } + } + + @TestMetadata("compiler/testData/asJava/lightClasses/publicField") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class PublicField extends AbstractIdeLightClassTest { + public void testAllFilesPresentInPublicField() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/publicField"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("CompanionObject.kt") + public void testCompanionObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/publicField/CompanionObject.kt"); + doTest(fileName); + } + + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/publicField/Simple.kt"); + doTest(fileName); + } + } +}