IDEA-48401 Ctrl+D should place caret on the variable name when copying a line consisting of variable declaration

This commit is contained in:
peter
2012-03-07 20:24:50 +04:00
parent d421b81c8c
commit 3a2ec64c13
3 changed files with 120 additions and 0 deletions
@@ -0,0 +1,38 @@
package com.intellij.codeInsight;
import com.intellij.openapi.actionSystem.IdeActions
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.jetbrains.annotations.NonNls
public class DuplicateActionTest extends LightCodeInsightFixtureTestCase {
public void testOneLine() {
doTest '''xxx<caret>
''', "txt", '''xxx
xxx<caret>
'''
}
public void testEmpty() {
doTest '<caret>', "txt", '\n<caret>'
}
private void doTest(String before, @NonNls String ext, String after) {
myFixture.configureByText("a." + ext, before);
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_DUPLICATE)
myFixture.checkResult(after);
}
public void testSelectName() {
doTest '''
class C {
void foo() {}<caret>
}
''', 'java', '''
class C {
void foo() {}
void <caret>foo() {}
}
'''
}
}