Fixed KotlinLintTestGenerated.testJavaPerformance + refactoring

Moved android lint tests from uast-kotlin to idea-android
This commit is contained in:
Vyacheslav Gerasimov
2016-11-07 12:18:20 +03:00
parent 3d75b78dc5
commit d90ec3e777
29 changed files with 38 additions and 41 deletions
@@ -156,7 +156,7 @@ import org.jetbrains.kotlin.serialization.AbstractLocalClassProtoTest
import org.jetbrains.kotlin.shortenRefs.AbstractShortenRefsTest import org.jetbrains.kotlin.shortenRefs.AbstractShortenRefsTest
import org.jetbrains.kotlin.test.TargetBackend import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.types.AbstractTypeBindingTest import org.jetbrains.kotlin.types.AbstractTypeBindingTest
import org.jetbrains.kotlin.uast.AbstractKotlinLintTest import org.jetbrains.kotlin.android.lint.AbstractKotlinLintTest
import java.io.File import java.io.File
import java.lang.IllegalArgumentException import java.lang.IllegalArgumentException
import java.util.* import java.util.*
@@ -1109,12 +1109,6 @@ fun main(args: Array<String>) {
} }
} }
testGroup("plugins/uast-kotlin/test", "plugins/uast-kotlin/testData") {
testClass<AbstractKotlinLintTest>() {
model("lint", excludeParentDirs = true)
}
}
testGroup("plugins/plugins-tests/tests", "plugins/annotation-collector/testData") { testGroup("plugins/plugins-tests/tests", "plugins/annotation-collector/testData") {
testClass<AbstractAnnotationProcessorBoxTest>() { testClass<AbstractAnnotationProcessorBoxTest>() {
model("collectToFile", recursive = false, extension = null) model("collectToFile", recursive = false, extension = null)
@@ -1165,6 +1159,10 @@ fun main(args: Array<String>) {
testClass<AbstractAndroidQuickFixMultiFileTest>() { testClass<AbstractAndroidQuickFixMultiFileTest>() {
model("android/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") model("android/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile")
} }
testClass<AbstractKotlinLintTest>() {
model("android/lint", excludeParentDirs = true)
}
} }
testGroup("plugins/plugins-tests/tests", "plugins/android-extensions/android-extensions-jps/testData") { testGroup("plugins/plugins-tests/tests", "plugins/android-extensions/android-extensions-jps/testData") {
+1
View File
@@ -20,5 +20,6 @@
<orderEntry type="module" module-name="frontend.java" /> <orderEntry type="module" module-name="frontend.java" />
<orderEntry type="module" module-name="tests-common" scope="TEST" /> <orderEntry type="module" module-name="tests-common" scope="TEST" />
<orderEntry type="module" module-name="idea-core" /> <orderEntry type="module" module-name="idea-core" />
<orderEntry type="module" module-name="lint-idea" scope="TEST" />
</component> </component>
</module> </module>
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.kotlin.uast package org.jetbrains.kotlin.android.lint
import org.jetbrains.android.inspections.klint.AndroidLintInspectionBase import org.jetbrains.android.inspections.klint.AndroidLintInspectionBase
import org.jetbrains.kotlin.android.KotlinAndroidTestCase import org.jetbrains.kotlin.android.KotlinAndroidTestCase
@@ -29,6 +29,8 @@ abstract class AbstractKotlinLintTest : KotlinAndroidTestCase() {
super.setUp() super.setUp()
ConfigLibraryUtil.configureKotlinRuntime(myModule) ConfigLibraryUtil.configureKotlinRuntime(myModule)
AndroidLintInspectionBase.invalidateInspectionShortName2IssueMap() AndroidLintInspectionBase.invalidateInspectionShortName2IssueMap()
// needs access to .class files in kotlin runtime jar
myFixture.allowTreeAccessForAllFiles()
} }
override fun tearDown() { override fun tearDown() {
@@ -69,5 +71,5 @@ abstract class AbstractKotlinLintTest : KotlinAndroidTestCase() {
myFixture.checkHighlighting(true, false, false) myFixture.checkHighlighting(true, false, false)
} }
override fun getTestDataPath() = KotlinTestUtils.getHomeDirectory() + "/plugins/uast-kotlin/testData/lint/" override fun getTestDataPath() = KotlinTestUtils.getHomeDirectory() + "/idea/testData/android/lint/"
} }
@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.kotlin.uast; package org.jetbrains.kotlin.android.lint;
import com.intellij.testFramework.TestDataPath; import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
@@ -28,155 +28,155 @@ import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ /** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all") @SuppressWarnings("all")
@TestMetadata("plugins/uast-kotlin/testData/lint") @TestMetadata("idea/testData/android/lint")
@TestDataPath("$PROJECT_ROOT") @TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class) @RunWith(JUnit3RunnerWithInners.class)
public class KotlinLintTestGenerated extends AbstractKotlinLintTest { public class KotlinLintTestGenerated extends AbstractKotlinLintTest {
@TestMetadata("alarm.kt") @TestMetadata("alarm.kt")
public void testAlarm() throws Exception { public void testAlarm() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/alarm.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/alarm.kt");
doTest(fileName); doTest(fileName);
} }
public void testAllFilesPresentInLint() throws Exception { public void testAllFilesPresentInLint() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("plugins/uast-kotlin/testData/lint"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/android/lint"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
} }
@TestMetadata("apiCheck.kt") @TestMetadata("apiCheck.kt")
public void testApiCheck() throws Exception { public void testApiCheck() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/apiCheck.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/apiCheck.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("callSuper.kt") @TestMetadata("callSuper.kt")
public void testCallSuper() throws Exception { public void testCallSuper() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/callSuper.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/callSuper.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("commitFragment.kt") @TestMetadata("commitFragment.kt")
public void testCommitFragment() throws Exception { public void testCommitFragment() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/commitFragment.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/commitFragment.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("javaPerformance.kt") @TestMetadata("javaPerformance.kt")
public void testJavaPerformance() throws Exception { public void testJavaPerformance() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/javaPerformance.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/javaPerformance.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("javaScriptInterface.kt") @TestMetadata("javaScriptInterface.kt")
public void testJavaScriptInterface() throws Exception { public void testJavaScriptInterface() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/javaScriptInterface.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/javaScriptInterface.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("layoutInflation.kt") @TestMetadata("layoutInflation.kt")
public void testLayoutInflation() throws Exception { public void testLayoutInflation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/layoutInflation.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/layoutInflation.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("log.kt") @TestMetadata("log.kt")
public void testLog() throws Exception { public void testLog() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/log.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/log.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("noInternationalSms.kt") @TestMetadata("noInternationalSms.kt")
public void testNoInternationalSms() throws Exception { public void testNoInternationalSms() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/noInternationalSms.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/noInternationalSms.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("overrideConcrete.kt") @TestMetadata("overrideConcrete.kt")
public void testOverrideConcrete() throws Exception { public void testOverrideConcrete() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/overrideConcrete.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/overrideConcrete.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("parcel.kt") @TestMetadata("parcel.kt")
public void testParcel() throws Exception { public void testParcel() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/parcel.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/parcel.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("sdCardTest.kt") @TestMetadata("sdCardTest.kt")
public void testSdCardTest() throws Exception { public void testSdCardTest() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/sdCardTest.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/sdCardTest.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("setJavaScriptEnabled.kt") @TestMetadata("setJavaScriptEnabled.kt")
public void testSetJavaScriptEnabled() throws Exception { public void testSetJavaScriptEnabled() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/setJavaScriptEnabled.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/setJavaScriptEnabled.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("sharedPrefs.kt") @TestMetadata("sharedPrefs.kt")
public void testSharedPrefs() throws Exception { public void testSharedPrefs() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/sharedPrefs.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/sharedPrefs.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("showDiagnosticsWhenFileIsRed.kt") @TestMetadata("showDiagnosticsWhenFileIsRed.kt")
public void testShowDiagnosticsWhenFileIsRed() throws Exception { public void testShowDiagnosticsWhenFileIsRed() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/showDiagnosticsWhenFileIsRed.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/showDiagnosticsWhenFileIsRed.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("sqlite.kt") @TestMetadata("sqlite.kt")
public void testSqlite() throws Exception { public void testSqlite() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/sqlite.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/sqlite.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("systemServices.kt") @TestMetadata("systemServices.kt")
public void testSystemServices() throws Exception { public void testSystemServices() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/systemServices.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/systemServices.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("toast.kt") @TestMetadata("toast.kt")
public void testToast() throws Exception { public void testToast() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/toast.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/toast.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("valueOf.kt") @TestMetadata("valueOf.kt")
public void testValueOf() throws Exception { public void testValueOf() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/valueOf.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/valueOf.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("viewConstructor.kt") @TestMetadata("viewConstructor.kt")
public void testViewConstructor() throws Exception { public void testViewConstructor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/viewConstructor.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/viewConstructor.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("viewHolder.kt") @TestMetadata("viewHolder.kt")
public void testViewHolder() throws Exception { public void testViewHolder() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/viewHolder.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/viewHolder.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("wrongAnnotation.kt") @TestMetadata("wrongAnnotation.kt")
public void testWrongAnnotation() throws Exception { public void testWrongAnnotation() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/wrongAnnotation.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/wrongAnnotation.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("wrongImport.kt") @TestMetadata("wrongImport.kt")
public void testWrongImport() throws Exception { public void testWrongImport() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/wrongImport.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/wrongImport.kt");
doTest(fileName); doTest(fileName);
} }
@TestMetadata("wrongViewCall.kt") @TestMetadata("wrongViewCall.kt")
public void testWrongViewCall() throws Exception { public void testWrongViewCall() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("plugins/uast-kotlin/testData/lint/wrongViewCall.kt"); String fileName = KotlinTestUtils.navigationMetadata("idea/testData/android/lint/wrongViewCall.kt");
doTest(fileName); doTest(fileName);
} }
} }
@@ -2,8 +2,8 @@
// INSPECTION_CLASS2: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintUseSparseArraysInspection // INSPECTION_CLASS2: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintUseSparseArraysInspection
// INSPECTION_CLASS3: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintUseValueOfInspection // INSPECTION_CLASS3: org.jetbrains.android.inspections.klint.AndroidLintInspectionToolProvider$AndroidKLintUseValueOfInspection
import java.util.HashMap
import android.annotation.SuppressLint import android.annotation.SuppressLint
import java.util.HashMap
import android.content.Context import android.content.Context
import android.graphics.* import android.graphics.*
import android.util.AttributeSet import android.util.AttributeSet
-4
View File
@@ -17,11 +17,7 @@
<orderEntry type="module" module-name="idea-analysis" /> <orderEntry type="module" module-name="idea-analysis" />
<orderEntry type="module" module-name="backend" /> <orderEntry type="module" module-name="backend" />
<orderEntry type="module" module-name="frontend.java" /> <orderEntry type="module" module-name="frontend.java" />
<orderEntry type="module" module-name="idea-test-framework" scope="TEST" />
<orderEntry type="module" module-name="tests-common" scope="TEST" />
<orderEntry type="module" module-name="android-extensions-idea" scope="TEST" />
<orderEntry type="module" module-name="light-classes" /> <orderEntry type="module" module-name="light-classes" />
<orderEntry type="module" module-name="util.runtime" /> <orderEntry type="module" module-name="util.runtime" />
<orderEntry type="module" module-name="lint-idea" scope="TEST" />
</component> </component>
</module> </module>