diff --git a/idea/testData/intentions/specifyType/afterBadCaretPosition.kt b/idea/testData/intentions/specifyType/afterBadCaretPosition.kt new file mode 100644 index 00000000000..73502bd79bf --- /dev/null +++ b/idea/testData/intentions/specifyType/afterBadCaretPosition.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "false" +val x = "" \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/afterClassNameClashing.kt b/idea/testData/intentions/specifyType/afterClassNameClashing.kt new file mode 100644 index 00000000000..274b7919733 --- /dev/null +++ b/idea/testData/intentions/specifyType/afterClassNameClashing.kt @@ -0,0 +1,7 @@ +// "Specify Type Explicitly" "true" +import java.util.Map + +fun getEntry() : java.util.Map.Entry, java.sql.Array> { +} + +val x : Map.Entry, java.sql.Array> = getEntry() \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/afterFunctionType.kt b/idea/testData/intentions/specifyType/afterFunctionType.kt new file mode 100644 index 00000000000..ceb61b24494 --- /dev/null +++ b/idea/testData/intentions/specifyType/afterFunctionType.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "true" +val x : (Int) -> String = { (a: Int) -> ""} \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/afterStringRedefined.kt b/idea/testData/intentions/specifyType/afterStringRedefined.kt new file mode 100644 index 00000000000..bb482a2f080 --- /dev/null +++ b/idea/testData/intentions/specifyType/afterStringRedefined.kt @@ -0,0 +1,4 @@ +// "Specify Type Explicitly" "true" +class String {} + +val x : jet.String = "" \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/afterTypeAlreadyProvided.kt b/idea/testData/intentions/specifyType/afterTypeAlreadyProvided.kt new file mode 100644 index 00000000000..e5a91213525 --- /dev/null +++ b/idea/testData/intentions/specifyType/afterTypeAlreadyProvided.kt @@ -0,0 +1,2 @@ +// "Remove Explicitly Specified Type" "true" +val x = "" \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/afterUnitType.kt b/idea/testData/intentions/specifyType/afterUnitType.kt new file mode 100644 index 00000000000..4f1a0038dc3 --- /dev/null +++ b/idea/testData/intentions/specifyType/afterUnitType.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "true" +val x : Unit = #() \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/afterUnknownType.kt b/idea/testData/intentions/specifyType/afterUnknownType.kt new file mode 100644 index 00000000000..55afdef17ef --- /dev/null +++ b/idea/testData/intentions/specifyType/afterUnknownType.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "false" +val x = BadType() \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeBadCaretPosition.kt b/idea/testData/intentions/specifyType/beforeBadCaretPosition.kt new file mode 100644 index 00000000000..73502bd79bf --- /dev/null +++ b/idea/testData/intentions/specifyType/beforeBadCaretPosition.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "false" +val x = "" \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeClassNameClashing.kt b/idea/testData/intentions/specifyType/beforeClassNameClashing.kt new file mode 100644 index 00000000000..ba06078de2f --- /dev/null +++ b/idea/testData/intentions/specifyType/beforeClassNameClashing.kt @@ -0,0 +1,5 @@ +// "Specify Type Explicitly" "true" +fun getEntry() : java.util.Map.Entry, java.sql.Array> { +} + +val x = getEntry() \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeFunctionType.kt b/idea/testData/intentions/specifyType/beforeFunctionType.kt new file mode 100644 index 00000000000..000957c3a47 --- /dev/null +++ b/idea/testData/intentions/specifyType/beforeFunctionType.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "true" +val x = { (a: Int) -> ""} \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeStringRedefined.kt b/idea/testData/intentions/specifyType/beforeStringRedefined.kt new file mode 100644 index 00000000000..4cbfb1802e6 --- /dev/null +++ b/idea/testData/intentions/specifyType/beforeStringRedefined.kt @@ -0,0 +1,4 @@ +// "Specify Type Explicitly" "true" +class String {} + +val x = "" \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeTypeAlreadyProvided.kt b/idea/testData/intentions/specifyType/beforeTypeAlreadyProvided.kt new file mode 100644 index 00000000000..b716acc6475 --- /dev/null +++ b/idea/testData/intentions/specifyType/beforeTypeAlreadyProvided.kt @@ -0,0 +1,2 @@ +// "Remove Explicitly Specified Type" "true" +val x : String = "" \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeUnitType.kt b/idea/testData/intentions/specifyType/beforeUnitType.kt new file mode 100644 index 00000000000..666a1e4b64f --- /dev/null +++ b/idea/testData/intentions/specifyType/beforeUnitType.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "true" +val x = #() \ No newline at end of file diff --git a/idea/testData/intentions/specifyType/beforeUnknownType.kt b/idea/testData/intentions/specifyType/beforeUnknownType.kt new file mode 100644 index 00000000000..55afdef17ef --- /dev/null +++ b/idea/testData/intentions/specifyType/beforeUnknownType.kt @@ -0,0 +1,2 @@ +// "Specify Type Explicitly" "false" +val x = BadType() \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/intentions/SpecifyTypeExplicitlyTest.java b/idea/tests/org/jetbrains/jet/plugin/intentions/SpecifyTypeExplicitlyTest.java new file mode 100644 index 00000000000..a0f1be09b42 --- /dev/null +++ b/idea/tests/org/jetbrains/jet/plugin/intentions/SpecifyTypeExplicitlyTest.java @@ -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"); + } +}