Make annotation collector tests more thorough

This commit is contained in:
Alexey Tsvetkov
2016-04-15 00:25:56 +03:00
parent e84ae5117d
commit 12531c4a90
16 changed files with 166 additions and 17 deletions
@@ -31,11 +31,12 @@ import java.io.StringWriter
abstract class AbstractAnnotationProcessorBoxTest : CodegenTestCase() {
override fun doTest(path: String) {
val testName = getTestName(true)
val fileName = path + testName + ".kt"
val ktFiles = File(path).listFiles { file -> file.isFile && file.extension.toLowerCase() == "kt" }
val testFiles = ktFiles.map { TestFile(it.name, it.readText()) }
val supportInheritedAnnotations = testName.startsWith("inherited")
val collectorExtension = createTestEnvironment(supportInheritedAnnotations)
loadFileByFullPath(fileName)
loadMultiFiles(testFiles)
CodegenTestUtil.generateFiles(myEnvironment, myFiles)
val actualAnnotations = KotlinTestUtils.replaceHashWithStar(collectorExtension.stringWriter.toString())
@@ -77,9 +77,9 @@ public class AnnotationProcessorBoxTestGenerated extends AbstractAnnotationProce
doTest(fileName);
}
@TestMetadata("inheritedSimple")
public void testInheritedSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/inheritedSimple/");
@TestMetadata("inheritedComplex")
public void testInheritedComplex() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/inheritedComplex/");
doTest(fileName);
}
@@ -95,12 +95,24 @@ public class AnnotationProcessorBoxTestGenerated extends AbstractAnnotationProce
doTest(fileName);
}
@TestMetadata("localFunctions")
public void testLocalFunctions() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/localFunctions/");
doTest(fileName);
}
@TestMetadata("methodAnnotations")
public void testMethodAnnotations() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/methodAnnotations/");
doTest(fileName);
}
@TestMetadata("multiFileTopLevelAnnotated")
public void testMultiFileTopLevelAnnotated() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/multiFileTopLevelAnnotated/");
doTest(fileName);
}
@TestMetadata("nestedClasses")
public void testNestedClasses() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/nestedClasses/");
@@ -112,4 +124,10 @@ public class AnnotationProcessorBoxTestGenerated extends AbstractAnnotationProce
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/platformStatic/");
doTest(fileName);
}
@TestMetadata("topLevelAnnotated")
public void testTopLevelAnnotated() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/annotation-collector/testData/collectToFile/topLevelAnnotated/");
doTest(fileName);
}
}