[JVM] Improve code coverage of EntriesMapping

Ensure that when .entries is accessed from an inline function body
or lambda argument, EntriesMapping are properly generated and used
without excessive mappings and duplicated fields

#KT-53236
This commit is contained in:
Vsevolod Tolstopyatov
2022-07-22 17:31:56 +02:00
committed by Space
parent 8a181cf2bd
commit c0f81cbc45
21 changed files with 495 additions and 0 deletions
@@ -440,6 +440,16 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumEntries")
@TestDataPath("$PROJECT_ROOT")
public class EnumEntries {
@Test
public void testAllFilesPresentInEnumEntries() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/enumEntries"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumWhen")
@TestDataPath("$PROJECT_ROOT")
@@ -440,6 +440,16 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumEntries")
@TestDataPath("$PROJECT_ROOT")
public class EnumEntries {
@Test
public void testAllFilesPresentInEnumEntries() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/enumEntries"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumWhen")
@TestDataPath("$PROJECT_ROOT")
@@ -385,6 +385,19 @@ public class IrCodegenBoxInlineWasmTestGenerated extends AbstractIrCodegenBoxInl
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
}
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumEntries")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EnumEntries extends AbstractIrCodegenBoxInlineWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInEnumEntries() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/enumEntries"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.WASM, true);
}
}
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumWhen")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)