[AA] Add tests for getSealedInheritors
- Previously, the sealed inheritors provider was only tested indirectly through diagnostics tests on `when` expressions. ^KT-66013
This commit is contained in:
committed by
Space Team
parent
1374bc8e2d
commit
5c8c3020c6
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.test.cases.generated.cases.components.inheritorsProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractDanglingFileSealedInheritorsTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeNormalAnalysisScriptSourceModuleDanglingFileSealedInheritorsTestGenerated extends AbstractDanglingFileSealedInheritorsTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.ScriptSource,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedInheritors() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors"), Pattern.compile("^(.+)\\.kts$"), null, true);
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.test.cases.generated.cases.components.inheritorsProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractSealedInheritorsTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeNormalAnalysisScriptSourceModuleSealedInheritorsTestGenerated extends AbstractSealedInheritorsTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.ScriptSource,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedInheritors() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors"), Pattern.compile("^(.+)\\.kts$"), null, true);
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.test.cases.generated.cases.components.inheritorsProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractDanglingFileSealedInheritorsTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeNormalAnalysisSourceModuleDanglingFileSealedInheritorsTestGenerated extends AbstractDanglingFileSealedInheritorsTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedInheritors() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromDependency.kt")
|
||||
public void testSealedClassFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromLibrary.kt")
|
||||
public void testSealedClassFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassSameModule.kt")
|
||||
public void testSealedClassSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassSameModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromDependency.kt")
|
||||
public void testSealedInterfaceFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromLibrary.kt")
|
||||
public void testSealedInterfaceFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceSameModule.kt")
|
||||
public void testSealedInterfaceSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceSameModule.kt");
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.test.cases.generated.cases.components.inheritorsProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.fir.test.configurators.AnalysisApiFirTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractSealedInheritorsTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirIdeNormalAnalysisSourceModuleSealedInheritorsTestGenerated extends AbstractSealedInheritorsTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Ide
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedInheritors() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromDependency.kt")
|
||||
public void testSealedClassFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromLibrary.kt")
|
||||
public void testSealedClassFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassSameModule.kt")
|
||||
public void testSealedClassSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassSameModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromDependency.kt")
|
||||
public void testSealedInterfaceFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromLibrary.kt")
|
||||
public void testSealedInterfaceFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceSameModule.kt")
|
||||
public void testSealedInterfaceSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceSameModule.kt");
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
|
||||
abstract class AbstractDanglingFileSealedInheritorsTest : AbstractSealedInheritorsTest() {
|
||||
override fun doTestByMainFile(mainFile: KtFile, mainModule: TestModule, testServices: TestServices) {
|
||||
val ktPsiFactory = KtPsiFactory.contextual(mainFile, markGenerated = true, eventSystemEnabled = false)
|
||||
val fakeKtFile = ktPsiFactory.createFile("fake.kt", mainFile.text)
|
||||
|
||||
super.doTestByMainFile(fakeKtFile, mainModule, testServices)
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.SymbolByFqName
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtNamedClassOrObjectSymbol
|
||||
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedTest
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.assertions
|
||||
|
||||
abstract class AbstractSealedInheritorsTest : AbstractAnalysisApiBasedTest() {
|
||||
override fun doTestByMainFile(mainFile: KtFile, mainModule: TestModule, testServices: TestServices) {
|
||||
analyseForTest(mainFile) {
|
||||
val actualText = with(SymbolByFqName.getSymbolDataFromFile(testDataPath)) {
|
||||
val classSymbol = toSymbols(mainFile).singleOrNull() as? KtNamedClassOrObjectSymbol
|
||||
?: error("Expected a single named class to be specified.")
|
||||
|
||||
classSymbol.getSealedClassInheritors().joinToString("\n\n") { inheritor ->
|
||||
"${inheritor.classIdIfNonLocal!!}\n${inheritor.render()}"
|
||||
}
|
||||
}
|
||||
|
||||
testServices.assertions.assertEqualsToTestDataFileSibling(actualText)
|
||||
}
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.standalone.fir.test.cases.generated.cases.components.inheritorsProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.fir.test.configurators.AnalysisApiFirStandaloneModeTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractDanglingFileSealedInheritorsTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirStandaloneNormalAnalysisSourceModuleDanglingFileSealedInheritorsTestGenerated extends AbstractDanglingFileSealedInheritorsTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirStandaloneModeTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Standalone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedInheritors() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromDependency.kt")
|
||||
public void testSealedClassFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromLibrary.kt")
|
||||
public void testSealedClassFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassSameModule.kt")
|
||||
public void testSealedClassSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassSameModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromDependency.kt")
|
||||
public void testSealedInterfaceFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromLibrary.kt")
|
||||
public void testSealedInterfaceFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceSameModule.kt")
|
||||
public void testSealedInterfaceSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceSameModule.kt");
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.standalone.fir.test.cases.generated.cases.components.inheritorsProvider;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.fir.test.configurators.AnalysisApiFirStandaloneModeTestConfiguratorFactory;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfiguratorFactoryData;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.TestModuleKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisSessionMode;
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiMode;
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractSealedInheritorsTest;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class FirStandaloneNormalAnalysisSourceModuleSealedInheritorsTestGenerated extends AbstractSealedInheritorsTest {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnalysisApiTestConfigurator getConfigurator() {
|
||||
return AnalysisApiFirStandaloneModeTestConfiguratorFactory.INSTANCE.createConfigurator(
|
||||
new AnalysisApiTestConfiguratorFactoryData(
|
||||
FrontendKind.Fir,
|
||||
TestModuleKind.Source,
|
||||
AnalysisSessionMode.Normal,
|
||||
AnalysisApiMode.Standalone
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInSealedInheritors() {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromDependency.kt")
|
||||
public void testSealedClassFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassFromLibrary.kt")
|
||||
public void testSealedClassFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedClassSameModule.kt")
|
||||
public void testSealedClassSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedClassSameModule.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromDependency.kt")
|
||||
public void testSealedInterfaceFromDependency() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceFromLibrary.kt")
|
||||
public void testSealedInterfaceFromLibrary() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceFromLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sealedInterfaceSameModule.kt")
|
||||
public void testSealedInterfaceSameModule() {
|
||||
runTest("analysis/analysis-api/testData/components/inheritorsProvider/sealedInheritors/sealedInterfaceSameModule.kt");
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// MODULE: dependency
|
||||
// FILE: MySealedClass.kt
|
||||
sealed class MySealedClass
|
||||
|
||||
class OneSealedChild : MySealedClass()
|
||||
class TwoSealedChild : MySealedClass()
|
||||
|
||||
// MODULE: main(dependency)
|
||||
// FILE: main.kt
|
||||
|
||||
// class: MySealedClass
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/OneSealedChild
|
||||
class OneSealedChild : MySealedClass()
|
||||
|
||||
/TwoSealedChild
|
||||
class TwoSealedChild : MySealedClass()
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// MODULE: lib
|
||||
// MODULE_KIND: LibraryBinary
|
||||
// FILE: MySealedClass.kt
|
||||
sealed class MySealedClass
|
||||
|
||||
class OneSealedChild : MySealedClass()
|
||||
class TwoSealedChild : MySealedClass()
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
// class: MySealedClass
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/OneSealedChild
|
||||
class OneSealedChild : MySealedClass()
|
||||
|
||||
/TwoSealedChild
|
||||
class TwoSealedChild : MySealedClass()
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
sealed class MySealedClass
|
||||
|
||||
class OneSealedChild : MySealedClass()
|
||||
class TwoSealedChild : MySealedClass()
|
||||
|
||||
// class: MySealedClass
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/OneSealedChild
|
||||
class OneSealedChild : MySealedClass()
|
||||
|
||||
/TwoSealedChild
|
||||
class TwoSealedChild : MySealedClass()
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// MODULE: dependency
|
||||
// FILE: MySealedInterface.kt
|
||||
sealed interface MySealedInterface
|
||||
|
||||
class OneSealedChild : MySealedInterface
|
||||
class TwoSealedChild : MySealedInterface
|
||||
|
||||
// MODULE: main(dependency)
|
||||
// FILE: main.kt
|
||||
|
||||
// class: MySealedInterface
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/OneSealedChild
|
||||
class OneSealedChild : MySealedInterface
|
||||
|
||||
/TwoSealedChild
|
||||
class TwoSealedChild : MySealedInterface
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// MODULE: lib
|
||||
// MODULE_KIND: LibraryBinary
|
||||
// FILE: MySealedInterface.kt
|
||||
sealed interface MySealedInterface
|
||||
|
||||
class OneSealedChild : MySealedInterface
|
||||
class TwoSealedChild : MySealedInterface
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
|
||||
// class: MySealedInterface
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/OneSealedChild
|
||||
class OneSealedChild : MySealedInterface
|
||||
|
||||
/TwoSealedChild
|
||||
class TwoSealedChild : MySealedInterface
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
sealed interface MySealedInterface
|
||||
|
||||
class OneSealedChild : MySealedInterface
|
||||
class TwoSealedChild : MySealedInterface
|
||||
|
||||
// class: MySealedInterface
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/OneSealedChild
|
||||
class OneSealedChild : MySealedInterface
|
||||
|
||||
/TwoSealedChild
|
||||
class TwoSealedChild : MySealedInterface
|
||||
+12
@@ -29,6 +29,8 @@ import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.express
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.expressionTypeProvider.AbstractExpectedExpressionTypeTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.expressionTypeProvider.AbstractHLExpressionTypeTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.importOptimizer.AbstractAnalysisApiImportOptimizerTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractDanglingFileSealedInheritorsTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.inheritorsProvider.AbstractSealedInheritorsTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.klibSourceFileProvider.AbstractGetKlibSourceFileNameTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.multiplatformInfoProvider.AbstractExpectForActualTest
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.psiTypeProvider.AbstractAnalysisApiExpressionPsiTypeProviderTest
|
||||
@@ -375,6 +377,16 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
||||
}
|
||||
}
|
||||
|
||||
component("inheritorsProvider", filter = analysisSessionModeIs(AnalysisSessionMode.Normal) and frontendIs(FrontendKind.Fir)) {
|
||||
test<AbstractSealedInheritorsTest> {
|
||||
model(it, "sealedInheritors")
|
||||
}
|
||||
|
||||
test<AbstractDanglingFileSealedInheritorsTest> {
|
||||
model(it, "sealedInheritors")
|
||||
}
|
||||
}
|
||||
|
||||
component("multiplatformInfoProvider") {
|
||||
test<AbstractExpectForActualTest> {
|
||||
model(it, "expectForActual")
|
||||
|
||||
Reference in New Issue
Block a user