From 79c2aa4acf29de1ef3cf08ae2f3a1ef9472f2e4f Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 16 Jul 2018 18:24:43 +0200 Subject: [PATCH] Minor, move tests on JvmField into subdirectory --- .../annotationCompanionWithAnnotation.kt} | 3 +- .../interfaceCompanion.kt} | 2 +- .../interfaceCompanionWithAnnotation.kt} | 3 +- .../ir/IrBlackBoxCodegenTestGenerated.java | 43 ++++++++++++------- .../codegen/BlackBoxCodegenTestGenerated.java | 43 ++++++++++++------- .../LightAnalysisModeTestGenerated.java | 43 ++++++++++++------- .../IrJsCodegenBoxTestGenerated.java | 13 ++++++ .../semantics/JsCodegenBoxTestGenerated.java | 13 ++++++ 8 files changed, 113 insertions(+), 50 deletions(-) rename compiler/testData/codegen/box/reflection/properties/{jvmFieldInAnnotationCompanionWithAnnotation.kt => jvmField/annotationCompanionWithAnnotation.kt} (96%) rename compiler/testData/codegen/box/reflection/properties/{jvmFieldInInterfaceCompanion.kt => jvmField/interfaceCompanion.kt} (97%) rename compiler/testData/codegen/box/reflection/properties/{jvmFieldInInterfaceCompanionWithAnnotation.kt => jvmField/interfaceCompanionWithAnnotation.kt} (96%) diff --git a/compiler/testData/codegen/box/reflection/properties/jvmFieldInAnnotationCompanionWithAnnotation.kt b/compiler/testData/codegen/box/reflection/properties/jvmField/annotationCompanionWithAnnotation.kt similarity index 96% rename from compiler/testData/codegen/box/reflection/properties/jvmFieldInAnnotationCompanionWithAnnotation.kt rename to compiler/testData/codegen/box/reflection/properties/jvmField/annotationCompanionWithAnnotation.kt index a360948af4f..93c3a07cf22 100644 --- a/compiler/testData/codegen/box/reflection/properties/jvmFieldInAnnotationCompanionWithAnnotation.kt +++ b/compiler/testData/codegen/box/reflection/properties/jvmField/annotationCompanionWithAnnotation.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +JvmFieldInInterface +NestedClassesInAnnotations // TARGET_BACKEND: JVM -// WITH_RUNTIME // WITH_REFLECT import kotlin.reflect.full.declaredMemberProperties @@ -19,4 +18,4 @@ annotation class Foo { fun box(): String { val field = Foo.Companion::class.declaredMemberProperties.single() return (field.annotations.single() as Ann).value + (field.get(Foo.Companion) as Bar).value -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanion.kt b/compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanion.kt similarity index 97% rename from compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanion.kt rename to compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanion.kt index f855b2598d1..fd04e5fa02c 100644 --- a/compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanion.kt +++ b/compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanion.kt @@ -2,8 +2,8 @@ // TARGET_BACKEND: JVM // IGNORE_BACKEND: JS // IGNORE_BACKEND: JS_IR -// WITH_RUNTIME // WITH_REFLECT + import kotlin.reflect.KProperty1 import kotlin.reflect.full.memberProperties import kotlin.reflect.full.companionObject diff --git a/compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanionWithAnnotation.kt b/compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanionWithAnnotation.kt similarity index 96% rename from compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanionWithAnnotation.kt rename to compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanionWithAnnotation.kt index 200093d27ee..40a05dd48b3 100644 --- a/compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanionWithAnnotation.kt +++ b/compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanionWithAnnotation.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +JvmFieldInInterface // TARGET_BACKEND: JVM -// WITH_RUNTIME // WITH_REFLECT import kotlin.reflect.full.declaredMemberProperties @@ -19,4 +18,4 @@ interface Foo { fun box(): String { val field = Foo.Companion::class.declaredMemberProperties.single() return (field.annotations.single() as Ann).value + (field.get(Foo.Companion) as Bar).value -} \ No newline at end of file +} diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 5f2737ab8fa..6487a4ca09e 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -18368,21 +18368,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/reflection/properties/javaStaticField.kt"); } - @TestMetadata("jvmFieldInAnnotationCompanionWithAnnotation.kt") - public void testJvmFieldInAnnotationCompanionWithAnnotation() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInAnnotationCompanionWithAnnotation.kt"); - } - - @TestMetadata("jvmFieldInInterfaceCompanion.kt") - public void testJvmFieldInInterfaceCompanion() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanion.kt"); - } - - @TestMetadata("jvmFieldInInterfaceCompanionWithAnnotation.kt") - public void testJvmFieldInInterfaceCompanionWithAnnotation() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanionWithAnnotation.kt"); - } - @TestMetadata("kotlinPropertyInheritedInJava.kt") public void testKotlinPropertyInheritedInJava() throws Exception { runTest("compiler/testData/codegen/box/reflection/properties/kotlinPropertyInheritedInJava.kt"); @@ -18594,6 +18579,34 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JvmField extends AbstractIrBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInJvmField() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/jvmField"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true); + } + + @TestMetadata("annotationCompanionWithAnnotation.kt") + public void testAnnotationCompanionWithAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/annotationCompanionWithAnnotation.kt"); + } + + @TestMetadata("interfaceCompanion.kt") + public void testInterfaceCompanion() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanion.kt"); + } + + @TestMetadata("interfaceCompanionWithAnnotation.kt") + public void testInterfaceCompanionWithAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanionWithAnnotation.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/localDelegated") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index ec492cde326..91ab3cb0d78 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -18368,21 +18368,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/reflection/properties/javaStaticField.kt"); } - @TestMetadata("jvmFieldInAnnotationCompanionWithAnnotation.kt") - public void testJvmFieldInAnnotationCompanionWithAnnotation() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInAnnotationCompanionWithAnnotation.kt"); - } - - @TestMetadata("jvmFieldInInterfaceCompanion.kt") - public void testJvmFieldInInterfaceCompanion() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanion.kt"); - } - - @TestMetadata("jvmFieldInInterfaceCompanionWithAnnotation.kt") - public void testJvmFieldInInterfaceCompanionWithAnnotation() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanionWithAnnotation.kt"); - } - @TestMetadata("kotlinPropertyInheritedInJava.kt") public void testKotlinPropertyInheritedInJava() throws Exception { runTest("compiler/testData/codegen/box/reflection/properties/kotlinPropertyInheritedInJava.kt"); @@ -18594,6 +18579,34 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JvmField extends AbstractBlackBoxCodegenTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJvmField() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/jvmField"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("annotationCompanionWithAnnotation.kt") + public void testAnnotationCompanionWithAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/annotationCompanionWithAnnotation.kt"); + } + + @TestMetadata("interfaceCompanion.kt") + public void testInterfaceCompanion() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanion.kt"); + } + + @TestMetadata("interfaceCompanionWithAnnotation.kt") + public void testInterfaceCompanionWithAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanionWithAnnotation.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/localDelegated") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 6e809bafab7..9df888063c0 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -18368,21 +18368,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/reflection/properties/javaStaticField.kt"); } - @TestMetadata("jvmFieldInAnnotationCompanionWithAnnotation.kt") - public void testJvmFieldInAnnotationCompanionWithAnnotation() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInAnnotationCompanionWithAnnotation.kt"); - } - - @TestMetadata("jvmFieldInInterfaceCompanion.kt") - public void testJvmFieldInInterfaceCompanion() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanion.kt"); - } - - @TestMetadata("jvmFieldInInterfaceCompanionWithAnnotation.kt") - public void testJvmFieldInInterfaceCompanionWithAnnotation() throws Exception { - runTest("compiler/testData/codegen/box/reflection/properties/jvmFieldInInterfaceCompanionWithAnnotation.kt"); - } - @TestMetadata("kotlinPropertyInheritedInJava.kt") public void testKotlinPropertyInheritedInJava() throws Exception { runTest("compiler/testData/codegen/box/reflection/properties/kotlinPropertyInheritedInJava.kt"); @@ -18594,6 +18579,34 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JvmField extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInJvmField() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/jvmField"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("annotationCompanionWithAnnotation.kt") + public void testAnnotationCompanionWithAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/annotationCompanionWithAnnotation.kt"); + } + + @TestMetadata("interfaceCompanion.kt") + public void testInterfaceCompanion() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanion.kt"); + } + + @TestMetadata("interfaceCompanionWithAnnotation.kt") + public void testInterfaceCompanionWithAnnotation() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/jvmField/interfaceCompanionWithAnnotation.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/localDelegated") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java index 8296feaf2c7..08f741e21dd 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java @@ -16804,6 +16804,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JvmField extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInJvmField() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/jvmField"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/localDelegated") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 01832702d2a..a70eb8d63be 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -17809,6 +17809,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class JvmField extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInJvmField() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/jvmField"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); + } + } + @TestMetadata("compiler/testData/codegen/box/reflection/properties/localDelegated") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)