mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-10 13:17:09 +07:00
IDEA-57936 Not-compiling code after reformating in Java
Added special handling of situation when target region to surround by braces ends with single-line comment
This commit is contained in:
@@ -73,4 +73,21 @@ public class JavaFormatterBracesTest extends AbstractJavaFormatterTest {
|
||||
"if (x > y) { System.out.println(\"foo!\"); }"
|
||||
);
|
||||
}
|
||||
|
||||
public void testEnforcingBracesForExpressionEndingWithLineComment() throws Exception {
|
||||
// Inspired by IDEA-57936
|
||||
getSettings().IF_BRACE_FORCE = CodeStyleSettings.FORCE_BRACES_ALWAYS;
|
||||
|
||||
doMethodTest(
|
||||
"if (true) i = 1; // Cool if\n" +
|
||||
"else i = 2;",
|
||||
|
||||
"if (true) {\n" +
|
||||
" i = 1; // Cool if\n" +
|
||||
"}\n" +
|
||||
"else {\n" +
|
||||
" i = 2;\n" +
|
||||
"}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user