Test for KT-7134 Command line entry point (main function is highlighted as unused)
#KT-7134 obsolete
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
<problems>
|
||||||
|
</problems>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.UnusedSymbolInspection
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fun main(args: Array<String>) {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.idea.test.JetLightCodeInsightFixtureTestCase
|
|||||||
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
import org.jetbrains.kotlin.test.InTextDirectivesUtils
|
||||||
import org.jetbrains.kotlin.test.JetTestUtils
|
import org.jetbrains.kotlin.test.JetTestUtils
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import kotlin.test.assertFalse
|
||||||
|
|
||||||
public abstract class AbstractJetInspectionTest: JetLightCodeInsightFixtureTestCase() {
|
public abstract class AbstractJetInspectionTest: JetLightCodeInsightFixtureTestCase() {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -79,10 +80,20 @@ public abstract class AbstractJetInspectionTest: JetLightCodeInsightFixtureTestC
|
|||||||
configureByText(file.getName(), fileText)!!
|
configureByText(file.getName(), fileText)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val isJs = srcDir.endsWith("js")
|
||||||
|
|
||||||
val isWithRuntime = psiFiles.any { InTextDirectivesUtils.findStringWithPrefixes(it.getText(), "// WITH_RUNTIME") != null }
|
val isWithRuntime = psiFiles.any { InTextDirectivesUtils.findStringWithPrefixes(it.getText(), "// WITH_RUNTIME") != null }
|
||||||
val fullJdk = psiFiles.any { InTextDirectivesUtils.findStringWithPrefixes(it.getText(), "// FULL_JDK") != null }
|
val fullJdk = psiFiles.any { InTextDirectivesUtils.findStringWithPrefixes(it.getText(), "// FULL_JDK") != null }
|
||||||
|
|
||||||
|
if (isJs) {
|
||||||
|
assertFalse(isWithRuntime)
|
||||||
|
assertFalse(fullJdk)
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (isJs) {
|
||||||
|
ConfigLibraryUtil.configureKotlinJsRuntime(myFixture.getModule())
|
||||||
|
}
|
||||||
if (isWithRuntime) {
|
if (isWithRuntime) {
|
||||||
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(
|
ConfigLibraryUtil.configureKotlinRuntimeAndSdk(
|
||||||
myFixture.getModule(),
|
myFixture.getModule(),
|
||||||
@@ -103,6 +114,9 @@ public abstract class AbstractJetInspectionTest: JetLightCodeInsightFixtureTestC
|
|||||||
if (isWithRuntime) {
|
if (isWithRuntime) {
|
||||||
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(myFixture.getModule(), IdeaTestUtil.getMockJdk17())
|
ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(myFixture.getModule(), IdeaTestUtil.getMockJdk17())
|
||||||
}
|
}
|
||||||
|
if (isJs) {
|
||||||
|
ConfigLibraryUtil.unConfigureKotlinJsRuntimeAndSdk(myFixture.getModule(), IdeaTestUtil.getMockJdk17())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,12 @@ public class JetInspectionTestGenerated extends AbstractJetInspectionTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("unusedSymbol/js/inspectionData/inspections.test")
|
||||||
|
public void testUnusedSymbol_js_inspectionData_Inspections_test() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/inspections/unusedSymbol/js/inspectionData/inspections.test");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unusedSymbol/object/inspectionData/inspections.test")
|
@TestMetadata("unusedSymbol/object/inspectionData/inspections.test")
|
||||||
public void testUnusedSymbol_object_inspectionData_Inspections_test() throws Exception {
|
public void testUnusedSymbol_object_inspectionData_Inspections_test() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/inspections/unusedSymbol/object/inspectionData/inspections.test");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/inspections/unusedSymbol/object/inspectionData/inspections.test");
|
||||||
|
|||||||
Reference in New Issue
Block a user