K1/K2: add BB test for (add/remove)(First/Last) calls on mutable list
Related to KT-64640
This commit is contained in:
committed by
Space Team
parent
940c3c81ad
commit
8c2f5c767f
+16
@@ -802,4 +802,20 @@ public class LLFirBlackBoxModernJdkCodegenBasedTestGenerated extends AbstractLLF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava21")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava21 {
|
||||
@Test
|
||||
@TestMetadata("addRemoveOnMutableList.kt")
|
||||
public void testAddRemoveOnMutableList() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava21/addRemoveOnMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava21() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava21"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -802,4 +802,20 @@ public class LLFirReversedBlackBoxModernJdkCodegenBasedTestGenerated extends Abs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava21")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava21 {
|
||||
@Test
|
||||
@TestMetadata("addRemoveOnMutableList.kt")
|
||||
public void testAddRemoveOnMutableList() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava21/addRemoveOnMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava21() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava21"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -803,4 +803,20 @@ public class FirLightTreeBlackBoxModernJdkCodegenTestGenerated extends AbstractF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava21")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava21 {
|
||||
@Test
|
||||
@TestMetadata("addRemoveOnMutableList.kt")
|
||||
public void testAddRemoveOnMutableList() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava21/addRemoveOnMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava21() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava21"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -803,4 +803,20 @@ public class FirPsiBlackBoxModernJdkCodegenTestGenerated extends AbstractFirPsiB
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava21")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava21 {
|
||||
@Test
|
||||
@TestMetadata("addRemoveOnMutableList.kt")
|
||||
public void testAddRemoveOnMutableList() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava21/addRemoveOnMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava21() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava21"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
fun foo(x: MutableList<String>) {
|
||||
x.addFirst("1")
|
||||
x.addLast("2")
|
||||
}
|
||||
|
||||
fun bar(x: MutableList<String>) {
|
||||
x.removeFirst()
|
||||
x.removeLast()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val list = mutableListOf("OK")
|
||||
foo(list)
|
||||
if (list.first() != "1") return "FAIL 1"
|
||||
if (list.last() != "2") return "FAIL 2"
|
||||
bar(list)
|
||||
return list.single()
|
||||
}
|
||||
+16
@@ -6767,6 +6767,22 @@ public class JvmAbiConsistencyTestRestGenerated extends AbstractJvmAbiConsistenc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava21")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava21 {
|
||||
@Test
|
||||
@TestMetadata("addRemoveOnMutableList.kt")
|
||||
public void testAddRemoveOnMutableList() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava21/addRemoveOnMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava21() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava21"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+10
@@ -767,4 +767,14 @@ public class BlackBoxModernJdkCodegenTestGenerated extends AbstractBlackBoxCodeg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava21")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava21 {
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava21() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava21"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -803,4 +803,20 @@ public class IrBlackBoxModernJdkCodegenTestGenerated extends AbstractIrBlackBoxC
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxModernJdk/testsWithJava21")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class TestsWithJava21 {
|
||||
@Test
|
||||
@TestMetadata("addRemoveOnMutableList.kt")
|
||||
public void testAddRemoveOnMutableList() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxModernJdk/testsWithJava21/addRemoveOnMutableList.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInTestsWithJava21() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxModernJdk/testsWithJava21"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -64,6 +64,13 @@ open class AbstractJvmAbiConsistencyTest :
|
||||
}
|
||||
}
|
||||
|
||||
forTestsMatching("compiler/testData/codegen/boxModernJdk/testsWithJava21/*") {
|
||||
defaultDirectives {
|
||||
JvmEnvironmentConfigurationDirectives.JDK_KIND with TestJdkKind.FULL_JDK_21
|
||||
JvmEnvironmentConfigurationDirectives.JVM_TARGET with JvmTarget.JVM_21
|
||||
}
|
||||
}
|
||||
|
||||
forTestsMatching("compiler/testData/codegen/box/javaInterop/foreignAnnotationsTests/tests/*") {
|
||||
defaultDirectives {
|
||||
ForeignAnnotationsDirectives.ANNOTATIONS_PATH with JavaForeignAnnotationType.Annotations
|
||||
|
||||
+4
@@ -110,4 +110,8 @@ fun TestConfigurationBuilder.configureModernJavaWhenNeeded() {
|
||||
forTestsMatching("compiler/testData/codegen/boxModernJdk/testsWithJava17/*") {
|
||||
configureModernJavaTest(TestJdkKind.FULL_JDK_17, JvmTarget.JVM_17)
|
||||
}
|
||||
|
||||
forTestsMatching("compiler/testData/codegen/boxModernJdk/testsWithJava21/*") {
|
||||
configureModernJavaTest(TestJdkKind.FULL_JDK_21, JvmTarget.JVM_21)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user