mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
Java: Regression test for extracting method from loop body (IDEA-152406)
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
class X {
|
||||
void foo() {
|
||||
boolean x = false;
|
||||
for (int i = 0; i < 100; i++) {<selection>
|
||||
x = true;
|
||||
if (i == 30) {
|
||||
break;
|
||||
}
|
||||
</selection>}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
class X {
|
||||
void foo() {
|
||||
boolean x = false;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
if (newMethod(i)) break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean newMethod(int i) {
|
||||
boolean x;
|
||||
x = true;
|
||||
if (i == 30) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -954,6 +954,10 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testVariableInLoopWithConditionalBreak() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testQualifyWhenConflictingNamePresent() throws Exception {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
|
||||
settings.ELSE_ON_NEW_LINE = true;
|
||||
|
||||
Reference in New Issue
Block a user