KT-59801 [FIR] scripting: tests for reference shortening
This commit is contained in:
+13
-1
@@ -43,7 +43,7 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerForWholeFileTestG
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInReferenceShortenerWholeFile() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -57,4 +57,16 @@ public class FirIdeNormalAnalysisSourceModuleReferenceShortenerForWholeFileTestG
|
||||
public void testFileWithMultipleDeclarations() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/fileWithMultipleDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("scriptFileWithImportStatement.kts")
|
||||
public void testScriptFileWithImportStatement() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/scriptFileWithImportStatement.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("scriptFileWithoutImportStatements.kts")
|
||||
public void testScriptFileWithoutImportStatements() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/scriptFileWithoutImportStatements.kts");
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -43,7 +43,7 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerForWholeFi
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInReferenceShortenerWholeFile() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile"), Pattern.compile("^(.+)\\.(kt|kts)$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -57,4 +57,16 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceShortenerForWholeFi
|
||||
public void testFileWithMultipleDeclarations() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/fileWithMultipleDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("scriptFileWithImportStatement.kts")
|
||||
public void testScriptFileWithImportStatement() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/scriptFileWithImportStatement.kts");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("scriptFileWithoutImportStatements.kts")
|
||||
public void testScriptFileWithoutImportStatements() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/components/referenceShortener/referenceShortenerWholeFile/scriptFileWithoutImportStatements.kts");
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// FILE: main.kts
|
||||
import a.b.c.dependency.Foo
|
||||
|
||||
fun foo<caret>(): a.b.c.dependency.Foo = t
|
||||
|
||||
// FILE: dependency.kt
|
||||
package a.b.c.dependency
|
||||
|
||||
class Foo {
|
||||
class Nested
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
[type] a.b.c.dependency.Foo
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[type] a.b.c.dependency.Foo
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[type] a.b.c.dependency.Foo
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// FILE: main.kts
|
||||
fun foo<caret>(): a.b.c.dependency.Foo = t
|
||||
|
||||
// FILE: dependency.kt
|
||||
package a.b.c.dependency
|
||||
|
||||
class Foo {
|
||||
class Nested
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
with DO_NOT_SHORTEN:
|
||||
with SHORTEN_IF_ALREADY_IMPORTED:
|
||||
with SHORTEN_AND_IMPORT:
|
||||
[type] a.b.c.dependency.Foo
|
||||
with SHORTEN_AND_STAR_IMPORT:
|
||||
[type] a.b.c.dependency.Foo
|
||||
+1
-1
@@ -235,7 +235,7 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
||||
model("referenceShortener")
|
||||
}
|
||||
test(AbstractReferenceShortenerForWholeFileTest::class) {
|
||||
model("referenceShortenerWholeFile")
|
||||
model("referenceShortenerWholeFile", pattern = TestGeneratorUtil.KT_OR_KTS)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user