intention to set default value to the parameter (IDEA-63040)

This commit is contained in:
anna
2011-06-10 12:29:53 +04:00
parent 8fa09e38b7
commit d61569c6ab
18 changed files with 298 additions and 0 deletions
@@ -0,0 +1,9 @@
// "Generate delegated method with default parameter value" "true"
class Test {
void foo() {
foo(<caret>);
}
void foo(int ii){
}
}
@@ -0,0 +1,8 @@
// "Generate delegated method with default parameter value" "true"
class Test {
Test() {
this(<caret>);
}
Test(int ii){}
}
@@ -0,0 +1,10 @@
// "Generate delegated method with default parameter value" "true"
class Test {
int foo() {
return foo(<caret>);
}
int foo(int ii){
return 1;
}
}
@@ -0,0 +1,10 @@
// "Generate delegated method with default parameter value" "true"
class Test {
<T> int foo(boolean... args) {
return foo(<caret>, args);
}
<T> int foo(T ii, boolean... args){
return 1;
}
}
@@ -0,0 +1,10 @@
// "Generate delegated method with default parameter value" "true"
class Test {
int foo(boolean... args) {
return foo(<caret>, args);
}
int foo(int ii, boolean... args){
return 1;
}
}
@@ -0,0 +1,5 @@
// "Generate delegated method with default parameter value" "true"
class Test {
void foo(int i<caret>i){
}
}
@@ -0,0 +1,4 @@
// "Generate delegated method with default parameter value" "true"
class Test {
Test(int i<caret>i){}
}
@@ -0,0 +1,6 @@
// "Generate delegated method with default parameter value" "false"
class Test {
void foo(){}
void foo(int i<caret>i){
}
}
@@ -0,0 +1,4 @@
// "Generate delegated method with default parameter value" "false"
interface Test {
void foo(int i<caret>i);
}
@@ -0,0 +1,6 @@
// "Generate delegated method with default parameter value" "true"
class Test {
int foo(int i<caret>i){
return 1;
}
}
@@ -0,0 +1,6 @@
// "Generate delegated method with default parameter value" "true"
class Test {
<T> int foo(T i<caret>i, boolean... args){
return 1;
}
}
@@ -0,0 +1,6 @@
// "Generate delegated method with default parameter value" "true"
class Test {
int foo(int i<caret>i, boolean... args){
return 1;
}
}
@@ -0,0 +1,51 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateState;
/**
* @author anna
*/
public class DelegateWithDefaultParamValueTest extends LightQuickFixTestCase {
@Override
protected void doAction(String text, boolean actionShouldBeAvailable, String testFullPath, String testName)
throws Exception {
try {
((TemplateManagerImpl)TemplateManagerImpl.getInstance(getProject())).setTemplateTesting(true);
super.doAction(text, actionShouldBeAvailable, testFullPath, testName);
if (actionShouldBeAvailable) {
TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
assert state != null;
state.gotoEnd(false);
}
} finally {
((TemplateManagerImpl)TemplateManagerImpl.getInstance(getProject())).setTemplateTesting(false);
}
}
public void test() throws Exception {
doAllTests();
}
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/delegateWithDefaultValue";
}
}