Adjust formatting for FILE_ANNOTATION_LIST

This commit is contained in:
Nikolay Krasko
2015-12-08 19:06:16 +03:00
parent 966ad9d3b6
commit 8a95f23a23
14 changed files with 83 additions and 0 deletions
@@ -84,6 +84,9 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
simple {
// ============ Line breaks ==============
before(FILE_ANNOTATION_LIST).lineBreakInCode()
after(FILE_ANNOTATION_LIST).blankLines(1)
after(PACKAGE_DIRECTIVE).blankLines(1)
between(IMPORT_DIRECTIVE, IMPORT_DIRECTIVE).lineBreakInCode()
after(IMPORT_LIST).blankLines(1)
@@ -0,0 +1,4 @@
/*
* Comment
*/
@file:Some("Hi")
@@ -0,0 +1,3 @@
/*
* Comment
*/ @file:Some("Hi")
@@ -0,0 +1,3 @@
@file:Some()
val test = 1
@@ -0,0 +1 @@
@file:Some() val test = 1
@@ -0,0 +1,3 @@
@file:Some()
import hi
@@ -0,0 +1 @@
@file:Some() import hi
@@ -0,0 +1,3 @@
@file:Some()
package test
@@ -0,0 +1 @@
@file:Some() package test
@@ -0,0 +1 @@
@file:Some()
@@ -0,0 +1 @@
@file:Some()
@@ -0,0 +1,7 @@
@file:Some()
@@ -0,0 +1,7 @@
@file:Some()
@@ -565,6 +565,51 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
doTest(fileName);
}
@TestMetadata("idea/testData/formatter/fileAnnotations")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class FileAnnotations extends AbstractFormatterTest {
@TestMetadata("afterComment.after.kt")
public void testAfterComment() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/fileAnnotations/afterComment.after.kt");
doTest(fileName);
}
public void testAllFilesPresentInFileAnnotations() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/formatter/fileAnnotations"), Pattern.compile("^([^\\.]+)\\.after\\.kt.*$"), true);
}
@TestMetadata("beforeDeclaration.after.kt")
public void testBeforeDeclaration() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/fileAnnotations/beforeDeclaration.after.kt");
doTest(fileName);
}
@TestMetadata("beforeImportList.after.kt")
public void testBeforeImportList() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/fileAnnotations/beforeImportList.after.kt");
doTest(fileName);
}
@TestMetadata("beforePackage.after.kt")
public void testBeforePackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/fileAnnotations/beforePackage.after.kt");
doTest(fileName);
}
@TestMetadata("inEmptyFile.after.kt")
public void testInEmptyFile() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/fileAnnotations/inEmptyFile.after.kt");
doTest(fileName);
}
@TestMetadata("manyLinesFromFileBegin.after.kt")
public void testManyLinesFromFileBegin() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/fileAnnotations/manyLinesFromFileBegin.after.kt");
doTest(fileName);
}
}
@TestMetadata("idea/testData/formatter/modifierList")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)