Implement "move expression up/down" action handler
This commit is contained in:
@@ -54,7 +54,17 @@ public class JetBlockExpression extends JetExpressionImpl implements JetStatemen
|
||||
|
||||
@Nullable
|
||||
public TextRange getLastBracketRange() {
|
||||
PsiElement rBrace = findChildByType(JetTokens.RBRACE);
|
||||
PsiElement rBrace = getRBrace();
|
||||
return rBrace != null ? rBrace.getTextRange() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getRBrace() {
|
||||
return findChildByType(JetTokens.RBRACE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getLBrace() {
|
||||
return findChildByType(JetTokens.LBRACE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -756,6 +756,59 @@ public class JetPsiUtil {
|
||||
return CommentUtilCore.isComment(element) || element instanceof KDocElement;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiElement getOutermostParent(@NotNull PsiElement element, @NotNull PsiElement upperBound, boolean strict) {
|
||||
PsiElement parent = strict ? element.getParent() : element;
|
||||
while (parent != null && parent.getParent() != upperBound) {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
public static <T extends PsiElement> T getLastChildByType(@NotNull PsiElement root, @NotNull Class<? extends T>... elementTypes) {
|
||||
PsiElement[] children = root.getChildren();
|
||||
|
||||
for (int i = children.length - 1; i >= 0; i--) {
|
||||
if (PsiTreeUtil.instanceOf(children[i], elementTypes)) {
|
||||
//noinspection unchecked
|
||||
return (T) children[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends JetElement> T getOutermostJetElement(
|
||||
@Nullable PsiElement root,
|
||||
boolean first,
|
||||
@NotNull final Class<? extends T>... elementTypes
|
||||
) {
|
||||
if (!(root instanceof JetElement)) return null;
|
||||
|
||||
final List<T> results = Lists.newArrayList();
|
||||
|
||||
((JetElement) root).accept(
|
||||
new JetVisitorVoid() {
|
||||
@Override
|
||||
public void visitJetElement(JetElement element) {
|
||||
if (PsiTreeUtil.instanceOf(element, elementTypes)) {
|
||||
//noinspection unchecked
|
||||
results.add((T) element);
|
||||
}
|
||||
else {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (results.isEmpty()) return null;
|
||||
|
||||
return first ? results.get(0) : results.get(results.size() - 1);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JetExpression getCalleeExpressionIfAny(@NotNull JetExpression expression) {
|
||||
if (expression instanceof JetCallElement) {
|
||||
|
||||
@@ -344,7 +344,9 @@ public class GenerateTests {
|
||||
"idea/tests/",
|
||||
"CodeMoverTestGenerated",
|
||||
AbstractCodeMoverTest.class,
|
||||
testModel("idea/testData/codeInsight/moveUpDown/classBodyDeclarations", "doTestClassBodyDeclaration")
|
||||
testModel("idea/testData/codeInsight/moveUpDown/classBodyDeclarations", "doTestClassBodyDeclaration"),
|
||||
testModel("idea/testData/codeInsight/moveUpDown/closingBraces", "doTestExpression"),
|
||||
testModel("idea/testData/codeInsight/moveUpDown/expressions", "doTestExpression")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -283,6 +283,10 @@
|
||||
serviceImplementation="org.jetbrains.jet.plugin.editor.JetEditorOptions"/>
|
||||
<editorAppearanceConfigurable instance="org.jetbrains.jet.plugin.editor.JetSettingEditorConfigurable"/>
|
||||
|
||||
<statementUpDownMover id="jetExpression"
|
||||
implementation="org.jetbrains.jet.plugin.codeInsight.upDownMover.JetExpressionMover"
|
||||
order="before declaration" />
|
||||
|
||||
<statementUpDownMover id="jetDeclaration"
|
||||
implementation="org.jetbrains.jet.plugin.codeInsight.upDownMover.JetDeclarationMover"
|
||||
order="before jetExpression" />
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
package org.jetbrains.jet.plugin.codeInsight.upDownMover;
|
||||
|
||||
import com.intellij.codeInsight.editorActions.moveUpDown.LineRange;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
public class JetExpressionMover extends AbstractJetUpDownMover {
|
||||
public JetExpressionMover() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("FieldMayBeFinal")
|
||||
private static Class[] MOVABLE_ELEMENT_CLASSES = {JetExpression.class, JetWhenEntry.class, PsiComment.class};
|
||||
|
||||
@SuppressWarnings("FieldMayBeFinal")
|
||||
private static Class[] BLOCKLIKE_ELEMENT_CLASSES =
|
||||
{JetBlockExpression.class, JetWhenExpression.class, JetPropertyAccessor.class, JetClassBody.class, JetFile.class};
|
||||
|
||||
@SuppressWarnings("FieldMayBeFinal")
|
||||
private static Class[] FUNCTIONLIKE_ELEMENT_CLASSES =
|
||||
{JetFunction.class, JetPropertyAccessor.class, JetClassInitializer.class};
|
||||
|
||||
@Nullable
|
||||
private static LineRange getLineRange(@NotNull PsiElement element, @NotNull Editor editor) {
|
||||
TextRange textRange = element.getTextRange();
|
||||
if (editor.getDocument().getTextLength() < textRange.getEndOffset()) return null;
|
||||
|
||||
int startLine = editor.offsetToLogicalPosition(textRange.getStartOffset()).line;
|
||||
int endLine = editor.offsetToLogicalPosition(textRange.getEndOffset()).line + 1;
|
||||
|
||||
return new LineRange(startLine, endLine);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiElement getStandaloneClosingBrace(@NotNull PsiFile file, @NotNull Editor editor) {
|
||||
LineRange range = getLineRangeFromSelection(editor);
|
||||
if (range.endLine - range.startLine != 1) return null;
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
Document document = editor.getDocument();
|
||||
int line = document.getLineNumber(offset);
|
||||
int lineStartOffset = document.getLineStartOffset(line);
|
||||
String lineText = document.getText().substring(lineStartOffset, document.getLineEndOffset(line));
|
||||
if (!lineText.trim().equals("}")) return null;
|
||||
|
||||
return file.findElementAt(lineStartOffset + lineText.indexOf('}'));
|
||||
}
|
||||
|
||||
private static boolean checkForMovableDownClosingBrace(
|
||||
@NotNull PsiElement closingBrace,
|
||||
@NotNull PsiElement block,
|
||||
@NotNull Editor editor,
|
||||
@NotNull MoveInfo info
|
||||
) {
|
||||
PsiElement current = block;
|
||||
PsiElement nextElement = null;
|
||||
PsiElement nextExpression = null;
|
||||
do {
|
||||
PsiElement sibling = firstNonWhiteElement(current.getNextSibling(), true);
|
||||
if (sibling != null && nextElement == null) {
|
||||
nextElement = sibling;
|
||||
}
|
||||
|
||||
if (sibling instanceof JetExpression) {
|
||||
nextExpression = sibling;
|
||||
break;
|
||||
}
|
||||
|
||||
current = current.getParent();
|
||||
}
|
||||
while (current != null && !(PsiTreeUtil.instanceOf(current, BLOCKLIKE_ELEMENT_CLASSES)));
|
||||
|
||||
if (nextExpression == null) return false;
|
||||
|
||||
Document doc = editor.getDocument();
|
||||
|
||||
info.toMove = new LineRange(closingBrace, closingBrace, doc);
|
||||
info.toMove2 = new LineRange(nextElement, nextExpression);
|
||||
info.indentSource = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean checkForMovableUpClosingBrace(
|
||||
@NotNull PsiElement closingBrace,
|
||||
PsiElement block,
|
||||
@NotNull Editor editor,
|
||||
@NotNull MoveInfo info
|
||||
) {
|
||||
//noinspection unchecked
|
||||
PsiElement prev = JetPsiUtil.getLastChildByType(block, JetExpression.class);
|
||||
if (prev == null) return false;
|
||||
|
||||
Document doc = editor.getDocument();
|
||||
|
||||
info.toMove = new LineRange(closingBrace, closingBrace, doc);
|
||||
info.toMove2 = new LineRange(prev, prev, doc);
|
||||
info.indentSource = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns null if standalone closing brace is not found
|
||||
private static Boolean checkForMovableClosingBrace(
|
||||
@NotNull Editor editor,
|
||||
@NotNull PsiFile file,
|
||||
@NotNull MoveInfo info,
|
||||
boolean down
|
||||
) {
|
||||
PsiElement closingBrace = getStandaloneClosingBrace(file, editor);
|
||||
if (closingBrace == null) return null;
|
||||
|
||||
PsiElement blockLikeElement = closingBrace.getParent();
|
||||
if (!(blockLikeElement instanceof JetBlockExpression)) return false;
|
||||
if (blockLikeElement.getParent() instanceof JetWhenEntry) return false;
|
||||
|
||||
PsiElement enclosingExpression = PsiTreeUtil.getParentOfType(blockLikeElement, JetExpression.class);
|
||||
|
||||
if (enclosingExpression instanceof JetDoWhileExpression) return false;
|
||||
|
||||
if (enclosingExpression instanceof JetIfExpression) {
|
||||
JetIfExpression ifExpression = (JetIfExpression) enclosingExpression;
|
||||
|
||||
if (blockLikeElement == ifExpression.getThen() && ifExpression.getElse() != null) return false;
|
||||
}
|
||||
|
||||
return down ? checkForMovableDownClosingBrace(closingBrace, blockLikeElement, editor, info) :
|
||||
checkForMovableUpClosingBrace(closingBrace, blockLikeElement, editor, info);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JetBlockExpression findClosestBlock(@NotNull PsiElement anchor, boolean down) {
|
||||
PsiElement current = PsiTreeUtil.getParentOfType(anchor, JetBlockExpression.class);
|
||||
while (current != null) {
|
||||
PsiElement parent = current.getParent();
|
||||
if (parent instanceof JetClassBody ||
|
||||
parent instanceof JetClassInitializer ||
|
||||
parent instanceof JetFunction ||
|
||||
parent instanceof JetProperty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parent instanceof JetBlockExpression) return (JetBlockExpression) parent;
|
||||
|
||||
PsiElement sibling = down ? current.getNextSibling() : current.getPrevSibling();
|
||||
if (sibling != null) {
|
||||
//noinspection unchecked
|
||||
JetBlockExpression block = JetPsiUtil.getOutermostJetElement(sibling, down, JetBlockExpression.class);
|
||||
if (block != null) return block;
|
||||
|
||||
current = sibling;
|
||||
}
|
||||
else {
|
||||
current = parent;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static LineRange getExpressionTargetRange(@NotNull Editor editor, @NotNull PsiElement sibling, boolean down) {
|
||||
PsiElement start = sibling;
|
||||
PsiElement end = sibling;
|
||||
|
||||
// moving out of code block
|
||||
if (sibling.getNode().getElementType() == (down ? JetTokens.RBRACE : JetTokens.LBRACE)) {
|
||||
PsiElement parent = sibling.getParent();
|
||||
if (!(parent instanceof JetBlockExpression)) return null;
|
||||
|
||||
JetBlockExpression block = (JetBlockExpression) parent;
|
||||
|
||||
JetBlockExpression newBlock = findClosestBlock(sibling, down);
|
||||
if (newBlock == null) return null;
|
||||
|
||||
if (PsiTreeUtil.isAncestor(newBlock, block, true)) {
|
||||
PsiElement outermostParent = JetPsiUtil.getOutermostParent(block, newBlock, true);
|
||||
|
||||
if (down) {
|
||||
end = outermostParent;
|
||||
}
|
||||
else {
|
||||
start = outermostParent;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (down) {
|
||||
end = newBlock.getLBrace();
|
||||
}
|
||||
else {
|
||||
start = newBlock.getRBrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// moving into code block
|
||||
//noinspection unchecked
|
||||
JetElement blockLikeElement = JetPsiUtil.getOutermostJetElement(sibling, down, JetBlockExpression.class, JetWhenExpression.class);
|
||||
if (blockLikeElement != null &&
|
||||
!(PsiTreeUtil.instanceOf(blockLikeElement, FUNCTIONLIKE_ELEMENT_CLASSES))) {
|
||||
if (blockLikeElement instanceof JetWhenExpression) {
|
||||
//noinspection unchecked
|
||||
blockLikeElement = JetPsiUtil.getOutermostJetElement(blockLikeElement, down, JetBlockExpression.class);
|
||||
}
|
||||
|
||||
if (blockLikeElement != null) {
|
||||
JetBlockExpression block = (JetBlockExpression) blockLikeElement;
|
||||
|
||||
if (down) {
|
||||
end = block.getLBrace();
|
||||
}
|
||||
else {
|
||||
start = block.getRBrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return start != null && end != null ? new LineRange(start, end, editor.getDocument()) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static LineRange getWhenEntryTargetRange(@NotNull Editor editor, @NotNull PsiElement sibling, boolean down) {
|
||||
if (sibling.getNode().getElementType() == (down ? JetTokens.RBRACE : JetTokens.LBRACE) &&
|
||||
PsiTreeUtil.getParentOfType(sibling, JetWhenEntry.class) == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LineRange(sibling, sibling, editor.getDocument());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static LineRange getTargetRange(
|
||||
@NotNull Editor editor,
|
||||
@Nullable PsiElement elementToCheck,
|
||||
@NotNull PsiElement sibling,
|
||||
boolean down
|
||||
) {
|
||||
if (elementToCheck instanceof JetExpression || elementToCheck instanceof PsiComment) {
|
||||
return getExpressionTargetRange(editor, sibling, down);
|
||||
}
|
||||
|
||||
if (elementToCheck instanceof JetWhenEntry) {
|
||||
return getWhenEntryTargetRange(editor, sibling, down);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static LineRange getSourceRange(@NotNull PsiElement firstElement, @NotNull PsiElement lastElement, @NotNull Editor editor) {
|
||||
if (firstElement == lastElement) {
|
||||
//noinspection ConstantConditions
|
||||
LineRange sourceRange = getLineRange(firstElement, editor);
|
||||
|
||||
if (sourceRange != null) {
|
||||
sourceRange.firstElement = sourceRange.lastElement = firstElement;
|
||||
}
|
||||
|
||||
return sourceRange;
|
||||
}
|
||||
|
||||
//noinspection ConstantConditions
|
||||
PsiElement parent = PsiTreeUtil.findCommonParent(firstElement, lastElement);
|
||||
if (parent == null) return null;
|
||||
|
||||
Pair<PsiElement, PsiElement> combinedRange = getElementRange(parent, firstElement, lastElement);
|
||||
|
||||
if (combinedRange == null
|
||||
|| !(PsiTreeUtil.instanceOf(combinedRange.first, MOVABLE_ELEMENT_CLASSES))
|
||||
|| !(PsiTreeUtil.instanceOf(combinedRange.second, MOVABLE_ELEMENT_CLASSES))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LineRange lineRange1 = getLineRange(combinedRange.first, editor);
|
||||
if (lineRange1 == null) return null;
|
||||
|
||||
LineRange lineRange2 = getLineRange(combinedRange.second, editor);
|
||||
if (lineRange2 == null) return null;
|
||||
|
||||
LineRange sourceRange = new LineRange(lineRange1.startLine, lineRange2.endLine);
|
||||
sourceRange.firstElement = combinedRange.first;
|
||||
sourceRange.lastElement = combinedRange.second;
|
||||
|
||||
return sourceRange;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkAvailable(@NotNull Editor editor, @NotNull PsiFile file, @NotNull MoveInfo info, boolean down) {
|
||||
if (!super.checkAvailable(editor, file, info, down)) return false;
|
||||
|
||||
Boolean closingBraceWin = checkForMovableClosingBrace(editor, file, info, down);
|
||||
if (closingBraceWin != null) {
|
||||
if (!closingBraceWin) {
|
||||
info.toMove2 = null;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
LineRange oldRange = info.toMove;
|
||||
|
||||
Pair<PsiElement, PsiElement> psiRange = getElementRange(editor, file, oldRange);
|
||||
if (psiRange == null) return false;
|
||||
|
||||
//noinspection unchecked
|
||||
PsiElement firstElement = PsiTreeUtil.getNonStrictParentOfType(psiRange.getFirst(), MOVABLE_ELEMENT_CLASSES);
|
||||
if (firstElement == null) return false;
|
||||
|
||||
//noinspection unchecked
|
||||
PsiElement lastElement = PsiTreeUtil.getNonStrictParentOfType(psiRange.getSecond(), MOVABLE_ELEMENT_CLASSES);
|
||||
if (lastElement == null) return false;
|
||||
|
||||
LineRange sourceRange = getSourceRange(firstElement, lastElement, editor);
|
||||
if (sourceRange == null) return false;
|
||||
|
||||
PsiElement sibling = adjustWhiteSpaceSibling(editor, sourceRange, info, down);
|
||||
|
||||
// Either reached last sibling, or jumped over multi-line whitespace
|
||||
if (sibling == null) return true;
|
||||
|
||||
info.toMove = sourceRange;
|
||||
info.toMove2 = getTargetRange(editor, sourceRange.firstElement, sibling, down);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// MOVE: down
|
||||
fun(n: Int) {
|
||||
for (i in 0..n) {
|
||||
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// MOVE: down
|
||||
fun(n: Int) {
|
||||
for (i in 0..n) {
|
||||
|
||||
val x = ""
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// MOVE: up
|
||||
// IS_APPLICABLE: false
|
||||
fun(n: Int) {
|
||||
for (i in 0..n) {
|
||||
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// MOVE: down
|
||||
fun(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// MOVE: down
|
||||
fun(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
val x = ""
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// MOVE: up
|
||||
// IS_APPLICABLE: false
|
||||
fun(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// MOVE: down
|
||||
// IS_APPLICABLE: false
|
||||
fun(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
}<caret>
|
||||
else {
|
||||
|
||||
}
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// MOVE: up
|
||||
// IS_APPLICABLE: false
|
||||
fun(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
}<caret>
|
||||
else {
|
||||
|
||||
}
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// MOVE: down
|
||||
fun foo(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
} else {
|
||||
|
||||
}<caret>
|
||||
while (n > 0) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// MOVE: down
|
||||
fun foo(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
} else {
|
||||
|
||||
while (n > 0) {
|
||||
|
||||
}
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// MOVE: down
|
||||
// IS_APPLICABLE: false
|
||||
fun foo(n: Int) {
|
||||
if (n > 0) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
while (n > 0) {
|
||||
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// IS_APPLICABLE: false
|
||||
// MOVE: down
|
||||
|
||||
fun foo(n: Int) {
|
||||
when (n) {
|
||||
0 -> {
|
||||
|
||||
}
|
||||
1 -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// IS_APPLICABLE: false
|
||||
// MOVE: up
|
||||
|
||||
fun foo(n: Int) {
|
||||
when (n) {
|
||||
0 -> {
|
||||
|
||||
}
|
||||
1 -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// IS_APPLICABLE: false
|
||||
// MOVE: down
|
||||
|
||||
fun foo(n: Int) {
|
||||
when (n) {
|
||||
0 -> {
|
||||
|
||||
}
|
||||
1 -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}<caret>
|
||||
}
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// IS_APPLICABLE: false
|
||||
// MOVE: up
|
||||
|
||||
fun foo(n: Int) {
|
||||
when (n) {
|
||||
0 -> {
|
||||
|
||||
}
|
||||
1 -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}<caret>
|
||||
}
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// IS_APPLICABLE: false
|
||||
// MOVE: down
|
||||
|
||||
fun foo(n: Int) {
|
||||
when (n) {
|
||||
0 -> {
|
||||
|
||||
}
|
||||
1 -> {
|
||||
|
||||
}<caret>
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// IS_APPLICABLE: false
|
||||
// MOVE: up
|
||||
|
||||
fun foo(n: Int) {
|
||||
when (n) {
|
||||
0 -> {
|
||||
|
||||
}
|
||||
1 -> {
|
||||
|
||||
}<caret>
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// MOVE: down
|
||||
fun(n: Int) {
|
||||
while (true) {
|
||||
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// MOVE: down
|
||||
fun(n: Int) {
|
||||
while (true) {
|
||||
|
||||
val x = ""
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// MOVE: up
|
||||
// IS_APPLICABLE: false
|
||||
fun(n: Int) {
|
||||
while (true) {
|
||||
|
||||
}<caret>
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// MOVE: down
|
||||
// IS_APPLICABLE: false
|
||||
fun(n: Int) {
|
||||
do {
|
||||
|
||||
}<caret>
|
||||
while (true)
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// MOVE: up
|
||||
// IS_APPLICABLE: false
|
||||
fun(n: Int) {
|
||||
do {
|
||||
|
||||
}<caret>
|
||||
while (true)
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
<caret>// test
|
||||
if (x) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
if (x) {
|
||||
<caret>// test
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// MOVE: down
|
||||
fun foo() {
|
||||
<caret>// test
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// MOVE: down
|
||||
fun foo() {
|
||||
val x = ""
|
||||
<caret>// test
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// MOVE: up
|
||||
fun foo() {
|
||||
val x = ""
|
||||
<caret>// test
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// MOVE: up
|
||||
fun foo() {
|
||||
<caret>// test
|
||||
val x = ""
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// MOVE: up
|
||||
fun foo(x: Boolean) {
|
||||
if (x) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
<caret>// test
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// MOVE: up
|
||||
fun foo(x: Boolean) {
|
||||
if (x) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
if (x) {
|
||||
<caret>// test
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
if (x) {
|
||||
}
|
||||
else {
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
if (x) {
|
||||
}
|
||||
else {
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
if (x) {
|
||||
<caret>// test
|
||||
}
|
||||
else {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
<caret>// test
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
<caret>// test
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
<caret>// test
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
<caret>// test
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
<caret>// test
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
<caret>// test
|
||||
}
|
||||
true -> {
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
}
|
||||
true -> {
|
||||
<caret>// test
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
<caret>// test
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
|
||||
}
|
||||
true -> {
|
||||
|
||||
<caret>// test
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
when (x) {
|
||||
false -> {
|
||||
<caret>// test
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// MOVE: up
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
<caret>// test
|
||||
when (x) {
|
||||
false -> {
|
||||
}
|
||||
true -> {
|
||||
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
<caret>// test
|
||||
while (x) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// MOVE: down
|
||||
|
||||
fun foo(x: Boolean) {
|
||||
while (x) {
|
||||
<caret>// test
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// MOVE: up
|
||||
fun foo(x: Boolean) {
|
||||
while (x) {
|
||||
|
||||
}
|
||||
<caret>// test
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// MOVE: up
|
||||
fun foo(x: Boolean) {
|
||||
while (x) {
|
||||
|
||||
<caret>// test
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.plugin.codeInsight.upDownMover.JetDeclarationMover;
|
||||
import org.jetbrains.jet.plugin.codeInsight.upDownMover.JetExpressionMover;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -34,6 +35,10 @@ public abstract class AbstractCodeMoverTest extends LightCodeInsightTestCase {
|
||||
doTest(path, JetDeclarationMover.class);
|
||||
}
|
||||
|
||||
public void doTestExpression(@NotNull String path) throws Exception {
|
||||
doTest(path, JetExpressionMover.class);
|
||||
}
|
||||
|
||||
private void doTest(@NotNull String path, @NotNull Class<? extends StatementUpDownMover> moverClass) throws Exception {
|
||||
configureByFile(path);
|
||||
|
||||
|
||||
+240
-1
@@ -30,7 +30,7 @@ import org.jetbrains.jet.plugin.codeInsight.moveUpDown.AbstractCodeMoverTest;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@InnerTestClasses({CodeMoverTestGenerated.ClassBodyDeclarations.class})
|
||||
@InnerTestClasses({CodeMoverTestGenerated.ClassBodyDeclarations.class, CodeMoverTestGenerated.ClosingBraces.class, CodeMoverTestGenerated.Expressions.class})
|
||||
public class CodeMoverTestGenerated extends AbstractCodeMoverTest {
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/classBodyDeclarations")
|
||||
@InnerTestClasses({ClassBodyDeclarations.Accessors.class, ClassBodyDeclarations.Class.class, ClassBodyDeclarations.ClassInitializer.class, ClassBodyDeclarations.Enums.class, ClassBodyDeclarations.Function.class, ClassBodyDeclarations.Property.class})
|
||||
@@ -450,9 +450,248 @@ public class CodeMoverTestGenerated extends AbstractCodeMoverTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces")
|
||||
@InnerTestClasses({ClosingBraces.For.class, ClosingBraces.If.class, ClosingBraces.Nested.class, ClosingBraces.When.class, ClosingBraces.While.class})
|
||||
public static class ClosingBraces extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInClosingBraces() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/for")
|
||||
public static class For extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInFor() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/for"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("for1.kt")
|
||||
public void testFor1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/for/for1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("for2.kt")
|
||||
public void testFor2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/for/for2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/if")
|
||||
public static class If extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInIf() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/if"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("if1.kt")
|
||||
public void testIf1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if2.kt")
|
||||
public void testIf2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if3.kt")
|
||||
public void testIf3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if4.kt")
|
||||
public void testIf4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/if/if4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/nested")
|
||||
public static class Nested extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInNested() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/nested"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("nested1.kt")
|
||||
public void testNested1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/nested/nested1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nested2.kt")
|
||||
public void testNested2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/nested/nested2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/when")
|
||||
public static class When extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInWhen() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/when"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("when1.kt")
|
||||
public void testWhen1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/when1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("when2.kt")
|
||||
public void testWhen2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/when2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry1.kt")
|
||||
public void testWhenEntry1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry2.kt")
|
||||
public void testWhenEntry2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry3.kt")
|
||||
public void testWhenEntry3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry4.kt")
|
||||
public void testWhenEntry4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/when/whenEntry4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/closingBraces/while")
|
||||
public static class While extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInWhile() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/closingBraces/while"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("while1.kt")
|
||||
public void testWhile1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while2.kt")
|
||||
public void testWhile2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while3.kt")
|
||||
public void testWhile3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while4.kt")
|
||||
public void testWhile4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/closingBraces/while/while4.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test innerSuite() {
|
||||
TestSuite suite = new TestSuite("ClosingBraces");
|
||||
suite.addTestSuite(ClosingBraces.class);
|
||||
suite.addTestSuite(For.class);
|
||||
suite.addTestSuite(If.class);
|
||||
suite.addTestSuite(Nested.class);
|
||||
suite.addTestSuite(When.class);
|
||||
suite.addTestSuite(While.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/codeInsight/moveUpDown/expressions")
|
||||
public static class Expressions extends AbstractCodeMoverTest {
|
||||
public void testAllFilesPresentInExpressions() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/codeInsight/moveUpDown/expressions"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("declaration1.kt")
|
||||
public void testDeclaration1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/declaration1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("declaration2.kt")
|
||||
public void testDeclaration2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/declaration2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("If1.kt")
|
||||
public void testIf1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/If1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if2.kt")
|
||||
public void testIf2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/if2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if3.kt")
|
||||
public void testIf3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/if3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("if4.kt")
|
||||
public void testIf4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/if4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("when1.kt")
|
||||
public void testWhen1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/when1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("when2.kt")
|
||||
public void testWhen2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/when2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry1.kt")
|
||||
public void testWhenEntry1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry2.kt")
|
||||
public void testWhenEntry2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry3.kt")
|
||||
public void testWhenEntry3() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry4.kt")
|
||||
public void testWhenEntry4() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry4.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry5.kt")
|
||||
public void testWhenEntry5() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry5.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("whenEntry6.kt")
|
||||
public void testWhenEntry6() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/whenEntry6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while1.kt")
|
||||
public void testWhile1() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/while1.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("while2.kt")
|
||||
public void testWhile2() throws Exception {
|
||||
doTestExpression("idea/testData/codeInsight/moveUpDown/expressions/while2.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("CodeMoverTestGenerated");
|
||||
suite.addTest(ClassBodyDeclarations.innerSuite());
|
||||
suite.addTest(ClosingBraces.innerSuite());
|
||||
suite.addTestSuite(Expressions.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user