mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
template ConstructorInsertHandler test (IDEA-101429)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import pack.Foo;
|
||||
class Test {
|
||||
{
|
||||
m(new Foo<String>() {
|
||||
@Override
|
||||
public void foo(String s) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
<T> void m(Foo<T> foo){}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import pack.Foo;
|
||||
class Test {
|
||||
{
|
||||
m(new Foo<String>() {
|
||||
@Override
|
||||
public void foo(String s) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
void m(Foo<String> foo){}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import pack.Foo;
|
||||
class Test {
|
||||
{
|
||||
m(new <caret>)
|
||||
}
|
||||
<T> void m(Foo<T> foo){}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import pack.Foo;
|
||||
class Test {
|
||||
{
|
||||
m(new <caret>)
|
||||
}
|
||||
void m(Foo<String> foo){}
|
||||
}
|
||||
+22
@@ -17,6 +17,8 @@ package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
|
||||
import com.intellij.codeInsight.template.impl.TemplateState;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
@@ -56,6 +58,26 @@ public class ClassNameCompletionTest extends LightFixtureCompletionTestCase {
|
||||
checkResultByFile(path + "/after2.java");
|
||||
}
|
||||
|
||||
public void testTypeParametersTemplate() throws Exception {
|
||||
createClass("package pack; public interface Foo<T> {void foo(T t};");
|
||||
|
||||
String path = "/template";
|
||||
|
||||
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
|
||||
configureByFile(path + "/before1.java");
|
||||
selectItem(myItems[0]);
|
||||
TemplateState state = TemplateManagerImpl.getTemplateState(myFixture.getEditor());
|
||||
type("String");
|
||||
assert state != null;
|
||||
state.gotoEnd(false);
|
||||
checkResultByFile(path + "/after1.java");
|
||||
|
||||
configureByFile(path + "/before2.java");
|
||||
selectItem(myItems[0]);
|
||||
assert TemplateManagerImpl.getTemplateState(myFixture.getEditor()) == null;
|
||||
checkResultByFile(path +"/after2.java");
|
||||
}
|
||||
|
||||
private void createClass(String text) {
|
||||
myFixture.addClass(text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user