mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
Formatting: wrapping and alignment in resource list
This commit is contained in:
+16
@@ -273,4 +273,20 @@ public class JavaFormatterAlignmentTest extends AbstractJavaFormatterTest {
|
||||
"}"
|
||||
);
|
||||
}
|
||||
|
||||
public void testAlignResourceList() throws Exception {
|
||||
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
|
||||
|
||||
getSettings().ALIGN_MULTILINE_RESOURCES = true;
|
||||
doMethodTest("try (MyResource r1 = null;\n" +
|
||||
"MyResource r2 = null) { }",
|
||||
"try (MyResource r1 = null;\n" +
|
||||
" MyResource r2 = null) { }");
|
||||
|
||||
getSettings().ALIGN_MULTILINE_RESOURCES = false;
|
||||
doMethodTest("try (MyResource r1 = null;\n" +
|
||||
"MyResource r2 = null) { }",
|
||||
"try (MyResource r1 = null;\n" +
|
||||
" MyResource r2 = null) { }");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
|
||||
getSettings().SPACE_BEFORE_SEMICOLON = false;
|
||||
getSettings().SPACE_AFTER_SEMICOLON = true;
|
||||
doMethodTest("try (R r1 = null ; R r2 = null;) { }",
|
||||
"try (R r1 = null; R r2 = null; ) { }");
|
||||
"try (R r1 = null; R r2 = null;) { }");
|
||||
|
||||
getSettings().SPACE_BEFORE_SEMICOLON = true;
|
||||
getSettings().SPACE_AFTER_SEMICOLON = false;
|
||||
|
||||
@@ -266,4 +266,21 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
|
||||
"@NotNull Comparable<String>"
|
||||
);
|
||||
}
|
||||
|
||||
public void testResourceListWrap() throws Exception {
|
||||
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
|
||||
getSettings().RIGHT_MARGIN = 40;
|
||||
getSettings().RESOURCE_LIST_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
|
||||
doMethodTest("try (MyResource r1 = null; MyResource r2 = null) { }",
|
||||
"try (MyResource r1 = null;\n" +
|
||||
" MyResource r2 = null) { }");
|
||||
|
||||
getSettings().RESOURCE_LIST_LPAREN_ON_NEXT_LINE = true;
|
||||
getSettings().RESOURCE_LIST_RPAREN_ON_NEXT_LINE = true;
|
||||
doMethodTest("try (MyResource r1 = null; MyResource r2 = null) { }",
|
||||
"try (\n" +
|
||||
" MyResource r1 = null;\n" +
|
||||
" MyResource r2 = null\n" +
|
||||
") { }");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user