mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-48401 Ctrl+D should place caret on the variable name when copying a line consisting of variable declaration
This commit is contained in:
@@ -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() {}
|
||||
}
|
||||
'''
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user