Corrected/removed tests related to on-the-fly import optimization

This commit is contained in:
Valentin Kipyatkov
2015-07-21 08:50:18 +03:00
parent b612e7a6b0
commit edcb330281
16 changed files with 6 additions and 95 deletions
@@ -1,5 +0,0 @@
package bar;
public interface Bar {
}
@@ -1,5 +0,0 @@
package bar;
public interface Other {
}
@@ -1,9 +0,0 @@
package foo;
import bar.Bar;
import bar.Other;
import java.util.ArrayList;
public class Foo {
abstract public Bar foo(ArrayList<Integer> list, Other other);
}
@@ -1,7 +0,0 @@
package foo
class Impl: Foo() {
<caret>
}
// KT-4732 Override/Implement action does not add all imports when "Optimize imports on the fly" is enabled
@@ -1,13 +0,0 @@
package foo
import bar.Bar
import bar.Other
import java.util.ArrayList
class Impl: Foo() {
override fun foo(list: ArrayList<Int>?, other: Other?): Bar? {
<selection><caret>throw UnsupportedOperationException()</selection>
}
}
// KT-4732 Override/Implement action does not add all imports when "Optimize imports on the fly" is enabled
@@ -1,5 +0,0 @@
// OPTIMIZE_IMPORTS: true
// NAME_COUNT_TO_USE_STAR_IMPORT: 1
import java.util.HashMap
val v: HashMap<String, <selection>java.util.Date</selection>>
@@ -1,5 +0,0 @@
// OPTIMIZE_IMPORTS: true
// NAME_COUNT_TO_USE_STAR_IMPORT: 1
import java.util.*
val v: HashMap<String, Date>
@@ -1,4 +1,3 @@
// OPTIMIZE_IMPORTS: true
import java.util.Date
val x = <selection>java.sql.Date(1)</selection>
@@ -1,4 +1,4 @@
// OPTIMIZE_IMPORTS: true
import java.sql.Date
import java.sql
import java.util.Date
val x = Date(1)
val x = sql.Date(1)
@@ -1,4 +1,3 @@
// OPTIMIZE_IMPORTS: true
import java.util.Date
class A : <selection>java.sql.Date</selection>
@@ -1,4 +1,4 @@
// OPTIMIZE_IMPORTS: true
import java.sql.Date
import java.sql
import java.util.Date
class A : Date
class A : sql.Date
@@ -1,4 +0,0 @@
// OPTIMIZE_IMPORTS: true
import java.io.*
<selection>class A(val d: java.sql.Date, val rs: java.sql.ResultSet)</selection>
@@ -1,5 +0,0 @@
// OPTIMIZE_IMPORTS: true
import java.sql.Date
import java.sql.ResultSet
class A(val d: Date, val rs: ResultSet)
@@ -34,14 +34,11 @@ public abstract class AbstractImportsTest : JetLightCodeInsightFixtureTestCase()
override fun getProjectDescriptor() = JetWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
protected fun doTest(testPath: String) {
val codeInsightSettings = CodeInsightSettings.getInstance()
val settingManager = CodeStyleSettingsManager.getInstance()
val tempSettings = settingManager.getCurrentSettings().clone()
settingManager.setTemporarySettings(tempSettings)
val codeStyleSettings = JetCodeStyleSettings.getInstance(getProject())
val optimizeImportsSaved = codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY
try {
val fixture = myFixture
@@ -59,7 +56,6 @@ public abstract class AbstractImportsTest : JetLightCodeInsightFixtureTestCase()
val file = fixture.getFile() as JetFile
val fileText = file.getText()
codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY = InTextDirectivesUtils.getPrefixedBoolean(fileText, "// OPTIMIZE_IMPORTS:") ?: false
codeStyleSettings.NAME_COUNT_TO_USE_STAR_IMPORT = InTextDirectivesUtils.getPrefixedInt(fileText, "// NAME_COUNT_TO_USE_STAR_IMPORT:") ?: nameCountToUseStarImportDefault
codeStyleSettings.IMPORT_PACKAGES = InTextDirectivesUtils.getPrefixedBoolean(fileText, "// IMPORT_PACKAGES:") ?: true
@@ -79,7 +75,6 @@ public abstract class AbstractImportsTest : JetLightCodeInsightFixtureTestCase()
JetTestUtils.assertEqualsToFile(File(testPath + ".after"), myFixture.getFile().getText())
}
finally {
codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY = optimizeImportsSaved
settingManager.dropTemporarySettings()
}
}
@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.idea.codeInsight;
import com.intellij.codeInsight.CodeInsightSettings;
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
public final class OverrideImplementTest extends AbstractOverrideImplementTest {
@@ -167,17 +166,6 @@ public final class OverrideImplementTest extends AbstractOverrideImplementTest {
doMultiOverrideFileTest();
}
public void testCheckNotImportedTypesFromJava() {
boolean oldValue = CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY;
try {
CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = true;
doImplementDirectoryTest();
}
finally {
CodeInsightSettings.getInstance().OPTIMIZE_IMPORTS_ON_THE_FLY = oldValue;
}
}
public void testOverrideSamAdapters() {
doOverrideDirectoryTest("foo");
}
@@ -190,12 +190,6 @@ public class ShortenRefsTestGenerated extends AbstractShortenRefsTest {
doTest(fileName);
}
@TestMetadata("ImportsOnTheFlyBug.kt")
public void testImportsOnTheFlyBug() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/shortenRefs/imports/ImportsOnTheFlyBug.kt");
doTest(fileName);
}
@TestMetadata("leaveQualifiedConstructor.kt")
public void testLeaveQualifiedConstructor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/shortenRefs/imports/leaveQualifiedConstructor.kt");
@@ -207,12 +201,6 @@ public class ShortenRefsTestGenerated extends AbstractShortenRefsTest {
String fileName = JetTestUtils.navigationMetadata("idea/testData/shortenRefs/imports/leaveQualifiedType.kt");
doTest(fileName);
}
@TestMetadata("optimizeMultipleImports.kt")
public void testOptimizeMultipleImports() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/shortenRefs/imports/optimizeMultipleImports.kt");
doTest(fileName);
}
}
@TestMetadata("idea/testData/shortenRefs/java")