Added tests for SpecifyTypeExplicitlyAction.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "false"
|
||||
val x = "<caret>"
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
import java.util.Map
|
||||
|
||||
fun getEntry() : java.util.Map.Entry<jet.Array<String>, java.sql.Array> {
|
||||
}
|
||||
|
||||
val x : Map.Entry<Array<String>, java.sql.Array> = getEntry()
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
val x : (Int) -> String = { (a: Int) -> ""}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
class String {}
|
||||
|
||||
val x : jet.String = ""
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Remove Explicitly Specified Type" "true"
|
||||
val x = ""
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
val x : Unit = #()
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "false"
|
||||
val <caret>x = BadType()
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "false"
|
||||
val x = "<caret>"
|
||||
@@ -0,0 +1,5 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
fun getEntry() : java.util.Map.Entry<jet.Array<String>, java.sql.Array> {
|
||||
}
|
||||
|
||||
val <caret>x = getEntry()
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
val x<caret> = { (a: Int) -> ""}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
class String {}
|
||||
|
||||
val <caret>x = ""
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Remove Explicitly Specified Type" "true"
|
||||
val x<caret> : String = ""
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "true"
|
||||
val x <caret>= #()
|
||||
@@ -0,0 +1,2 @@
|
||||
// "Specify Type Explicitly" "false"
|
||||
val <caret>x = BadType()
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2010-2012 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 org.jetbrains.jet.plugin.intentions;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightIntentionActionTestCase;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
public class SpecifyTypeExplicitlyTest extends LightIntentionActionTestCase {
|
||||
public void testBadCaretPosition() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClassNameClashing() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFunctionType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStringRedefined() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testTypeAlreadyProvided() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUnitType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testUnknownType() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginTestCaseBase.getTestDataPathBase() + "/intentions/";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return PluginTestCaseBase.jdkFromIdeaHome();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "specifyType";
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doSingleTest(getTestName(false) + ".kt");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user