mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[Java. Code Formatting] Add tests for idempontent formatting for java method declarations
IDEA-165216 GitOrigin-RevId: cc5cd68d5c16b737052765809c075d4a473fa7ad
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0aee70350c
commit
5813964716
@@ -3,4 +3,7 @@ import java.time.Month;
|
||||
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,12 @@ public class Main {
|
||||
1,
|
||||
2,
|
||||
3);
|
||||
|
||||
public void foo(
|
||||
int longArgument1,
|
||||
int longArgument2,
|
||||
int longArgument3,
|
||||
int short4,
|
||||
int receiver1) {
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,6 @@ import java.time.Month;
|
||||
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {}
|
||||
}
|
||||
@@ -3,4 +3,7 @@ import java.time.Month;
|
||||
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {
|
||||
}
|
||||
}
|
||||
@@ -15,4 +15,13 @@ public class Test {
|
||||
public void fooBarBaz(int... args) {
|
||||
fooBarBaz(100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000, 100000);
|
||||
}
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {
|
||||
}
|
||||
|
||||
static void vertLongMethodName(int longArgument1, int longArgument2, int longArgument3, int short4) {
|
||||
}
|
||||
|
||||
public <T, V extends Test> void typedMethod(@Deprecated List<? extends T> field1, @Deprecated List<? super T> field2) {
|
||||
}
|
||||
}
|
||||
@@ -41,4 +41,24 @@ public class Test {
|
||||
100000,
|
||||
100000);
|
||||
}
|
||||
|
||||
public void foo(
|
||||
int longArgument1,
|
||||
int longArgument2,
|
||||
int longArgument3,
|
||||
int short4,
|
||||
int receiver1) {
|
||||
}
|
||||
|
||||
static void vertLongMethodName(
|
||||
int longArgument1,
|
||||
int longArgument2,
|
||||
int longArgument3,
|
||||
int short4) {
|
||||
}
|
||||
|
||||
public <T, V extends Test> void typedMethod(
|
||||
@Deprecated List<? extends T> field1,
|
||||
@Deprecated List<? super T> field2) {
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,7 @@ import java.time.Month;
|
||||
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1, int receiver3) {
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,13 @@ public class Main {
|
||||
1,
|
||||
2,
|
||||
3);
|
||||
|
||||
public void foo(
|
||||
int longArgument1,
|
||||
int longArgument2,
|
||||
int longArgument3,
|
||||
int short4,
|
||||
int receiver1,
|
||||
int receiver3) {
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,7 @@ import java.time.Month;
|
||||
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,8 @@ import java.time.Month;
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(
|
||||
2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(
|
||||
int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,6 @@ import java.time.Month;
|
||||
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {}
|
||||
}
|
||||
@@ -3,4 +3,7 @@ import java.time.Month;
|
||||
|
||||
public class Main {
|
||||
private static final LocalDateTime localDateTime = LocalDateTime.of(2017, Month.NOVEMBER, 1, 2, 3);
|
||||
|
||||
public void foo(int longArgument1, int longArgument2, int longArgument3, int short4, int receiver1) {
|
||||
}
|
||||
}
|
||||
@@ -13,32 +13,33 @@ class JavaFormatterNewLineAfterLBraceTest : JavaFormatterTestCase() {
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
commonSettings.CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = true
|
||||
commonSettings.METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE = true
|
||||
commonSettings.RIGHT_MARGIN = 100
|
||||
}
|
||||
|
||||
fun testWrapAlways() {
|
||||
commonSettings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS
|
||||
setupWrapType(CommonCodeStyleSettings.WRAP_ALWAYS)
|
||||
doIdempotentTest()
|
||||
}
|
||||
|
||||
fun testChopDownIfLongMultipleLines() {
|
||||
commonSettings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM
|
||||
setupWrapType(CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM)
|
||||
doIdempotentTest()
|
||||
}
|
||||
|
||||
fun testChopDownIfLongSingleLine() {
|
||||
commonSettings.RIGHT_MARGIN = 200
|
||||
commonSettings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM
|
||||
setupWrapType(CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM)
|
||||
doIdempotentTest()
|
||||
}
|
||||
|
||||
fun testDoNotWrap() {
|
||||
commonSettings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP
|
||||
setupWrapType(CommonCodeStyleSettings.DO_NOT_WRAP)
|
||||
doTest()
|
||||
}
|
||||
|
||||
fun testWrapAsNeedSingleLine() {
|
||||
commonSettings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED
|
||||
setupWrapType(CommonCodeStyleSettings.WRAP_AS_NEEDED)
|
||||
doIdempotentTest()
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ class JavaFormatterNewLineAfterLBraceTest : JavaFormatterTestCase() {
|
||||
}
|
||||
|
||||
fun testMultipleCalls() {
|
||||
commonSettings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM
|
||||
setupWrapType(CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM)
|
||||
doIdempotentTest()
|
||||
}
|
||||
|
||||
@@ -57,4 +58,9 @@ class JavaFormatterNewLineAfterLBraceTest : JavaFormatterTestCase() {
|
||||
doTest(testName, "${testName}_after")
|
||||
doTest("${testName}_after", "${testName}_after")
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupWrapType(wrapType: Int) {
|
||||
commonSettings.CALL_PARAMETERS_WRAP = wrapType
|
||||
commonSettings.METHOD_PARAMETERS_WRAP = wrapType
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user