KTIJ-27841 [AA] Add simple test cases for the classes with same name conflicts

This commit is contained in:
Roman Golyshev
2024-01-10 21:44:32 +01:00
committed by teamcity
parent 0e244b3fbf
commit 1e2f612cbc
21 changed files with 358 additions and 0 deletions
@@ -52,6 +52,26 @@ public class FirIdeNormalAnalysisScriptSourceModuleReferenceShortenerTestGenerat
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/callInsideScriptExpression.kts");
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts")
@TestDataPath("$PROJECT_ROOT")
public class Conflicts {
@Test
public void testAllFilesPresentInConflicts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts"), Pattern.compile("^(.+)\\.kts$"), null, true);
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName")
@TestDataPath("$PROJECT_ROOT")
public class ClassWithSameName {
@Test
public void testAllFilesPresentInClassWithSameName() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName"), Pattern.compile("^(.+)\\.kts$"), null, true);
}
}
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/nestedClasses")
@TestDataPath("$PROJECT_ROOT")
@@ -658,6 +658,80 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerTestGenerated ext
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/_rootIdePackage_IsNotRemovedIfNotSelected.kt");
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts")
@TestDataPath("$PROJECT_ROOT")
public class Conflicts {
@Test
public void testAllFilesPresentInConflicts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName")
@TestDataPath("$PROJECT_ROOT")
public class ClassWithSameName {
@Test
public void testAllFilesPresentInClassWithSameName() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("constructorCall_vs_constructorCall.kt")
public void testConstructorCall_vs_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/constructorCall_vs_constructorCall.kt");
}
@Test
@TestMetadata("constructorCall_vs_noUsages.kt")
public void testConstructorCall_vs_noUsages() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/constructorCall_vs_noUsages.kt");
}
@Test
@TestMetadata("constructorCall_vs_typeRefs.kt")
public void testConstructorCall_vs_typeRefs() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/constructorCall_vs_typeRefs.kt");
}
@Test
@TestMetadata("qualifier_vs_constructorCall.kt")
public void testQualifier_vs_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/qualifier_vs_constructorCall.kt");
}
@Test
@TestMetadata("qualifier_vs_noUsages.kt")
public void testQualifier_vs_noUsages() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/qualifier_vs_noUsages.kt");
}
@Test
@TestMetadata("qualifier_vs_typeRef.kt")
public void testQualifier_vs_typeRef() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/qualifier_vs_typeRef.kt");
}
@Test
@TestMetadata("typeRef_vs_constructorCall.kt")
public void testTypeRef_vs_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/typeRef_vs_constructorCall.kt");
}
@Test
@TestMetadata("typeRef_vs_noUsages.kt")
public void testTypeRef_vs_noUsages() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/typeRef_vs_noUsages.kt");
}
@Test
@TestMetadata("typeRef_vs_typeRef.kt")
public void testTypeRef_vs_typeRef() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/typeRef_vs_typeRef.kt");
}
}
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/nestedClasses")
@TestDataPath("$PROJECT_ROOT")
@@ -658,6 +658,80 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerTestGenera
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/_rootIdePackage_IsNotRemovedIfNotSelected.kt");
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts")
@TestDataPath("$PROJECT_ROOT")
public class Conflicts {
@Test
public void testAllFilesPresentInConflicts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName")
@TestDataPath("$PROJECT_ROOT")
public class ClassWithSameName {
@Test
public void testAllFilesPresentInClassWithSameName() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("constructorCall_vs_constructorCall.kt")
public void testConstructorCall_vs_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/constructorCall_vs_constructorCall.kt");
}
@Test
@TestMetadata("constructorCall_vs_noUsages.kt")
public void testConstructorCall_vs_noUsages() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/constructorCall_vs_noUsages.kt");
}
@Test
@TestMetadata("constructorCall_vs_typeRefs.kt")
public void testConstructorCall_vs_typeRefs() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/constructorCall_vs_typeRefs.kt");
}
@Test
@TestMetadata("qualifier_vs_constructorCall.kt")
public void testQualifier_vs_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/qualifier_vs_constructorCall.kt");
}
@Test
@TestMetadata("qualifier_vs_noUsages.kt")
public void testQualifier_vs_noUsages() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/qualifier_vs_noUsages.kt");
}
@Test
@TestMetadata("qualifier_vs_typeRef.kt")
public void testQualifier_vs_typeRef() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/qualifier_vs_typeRef.kt");
}
@Test
@TestMetadata("typeRef_vs_constructorCall.kt")
public void testTypeRef_vs_constructorCall() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/typeRef_vs_constructorCall.kt");
}
@Test
@TestMetadata("typeRef_vs_noUsages.kt")
public void testTypeRef_vs_noUsages() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/typeRef_vs_noUsages.kt");
}
@Test
@TestMetadata("typeRef_vs_typeRef.kt")
public void testTypeRef_vs_typeRef() throws Exception {
runTest("analysis/analysis-api/testData/components/referenceShortener/shortenRange/conflicts/classWithSameName/typeRef_vs_typeRef.kt");
}
}
}
@Nested
@TestMetadata("analysis/analysis-api/testData/components/referenceShortener/shortenRange/nestedClasses")
@TestDataPath("$PROJECT_ROOT")
@@ -0,0 +1,14 @@
// FILE: main.kt
package test
class MyFoo
fun constructorCall = MyFoo()
val myDepFoo = <expr>dependency.MyFoo()</expr>
// FILE: dependency.kt
package dependency
class MyFoo
@@ -0,0 +1,8 @@
Before shortening: dependency.MyFoo()
with default settings:
[qualifier] dependency.MyFoo()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[qualifier] dependency.MyFoo()
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,12 @@
// FILE: main.kt
package test
class MyFoo
val myFoo = <expr>dependency.MyFoo()</expr>
// FILE: dependency.kt
package dependency
class MyFoo
@@ -0,0 +1,8 @@
Before shortening: dependency.MyFoo()
with default settings:
[qualifier] dependency.MyFoo()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[qualifier] dependency.MyFoo()
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,14 @@
// FILE: main.kt
package test
class MyFoo
val typeRef: MyFoo
val myFoo = <expr>dependency.MyFoo()</expr>
// FILE: dependency.kt
package dependency
class MyFoo
@@ -0,0 +1,8 @@
Before shortening: dependency.MyFoo()
with default settings:
[qualifier] dependency.MyFoo()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[qualifier] dependency.MyFoo()
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,16 @@
// FILE: main.kt
package test
class MyFoo
val constructorCall = MyFoo()
val nested = <expr>dependency.MyFoo</expr>.Nested()
// FILE: dependency.kt
package dependency
class MyFoo {
class Nested
}
@@ -0,0 +1,6 @@
Before shortening: dependency.MyFoo
with default settings:
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,14 @@
// FILE: main.kt
package test
class MyFoo
val nested = <expr>dependency.MyFoo</expr>.Nested()
// FILE: dependency.kt
package dependency
class MyFoo {
class Nested
}
@@ -0,0 +1,8 @@
Before shortening: dependency.MyFoo
with default settings:
[qualifier] dependency.MyFoo
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[qualifier] dependency.MyFoo
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,16 @@
// FILE: main.kt
package test
class MyFoo
val typeUsage: MyFoo
val nested = <expr>dependency.MyFoo</expr>.Nested()
// FILE: dependency.kt
package dependency
class MyFoo {
class Nested
}
@@ -0,0 +1,6 @@
Before shortening: dependency.MyFoo
with default settings:
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,14 @@
// FILE: main.kt
package test
class MyFoo
val constructorCall = MyFoo()
fun usage(myFoo: <expr>dependency.MyFoo</expr>) {}
// FILE: dependency.kt
package dependency
class MyFoo
@@ -0,0 +1,6 @@
Before shortening: dependency.MyFoo
with default settings:
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,12 @@
// FILE: main.kt
package test
class MyFoo
fun usage(myFoo: <expr>dependency.MyFoo</expr>) {}
// FILE: dependency.kt
package dependency
class MyFoo
@@ -0,0 +1,8 @@
Before shortening: dependency.MyFoo
with default settings:
[type] dependency.MyFoo
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[type] dependency.MyFoo
with SHORTEN_AND_STAR_IMPORT:
@@ -0,0 +1,14 @@
// FILE: main.kt
package test
class MyFoo
val typeUsage: MyFoo
fun usage(myFoo: <expr>dependency.MyFoo</expr>) {}
// FILE: dependency.kt
package dependency
class MyFoo
@@ -0,0 +1,6 @@
Before shortening: dependency.MyFoo
with default settings:
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
with SHORTEN_AND_STAR_IMPORT: