[Test gen] Reduce Kotlin reflection usage
This commit is contained in:
committed by
Space Team
parent
6cfe81de50
commit
7ca6624af4
+81
-104
@@ -55,7 +55,6 @@ import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typePro
|
|||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractHasCommonSubtypeTest
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractHasCommonSubtypeTest
|
||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractTypeReferenceTest
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.components.typeProvider.AbstractTypeReferenceTest
|
||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.*
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.*
|
||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.references.AbstractReferenceImportAliasTest
|
|
||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.*
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.symbols.*
|
||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.types.AbstractAnalysisApiSubstitutorsTest
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.types.AbstractAnalysisApiSubstitutorsTest
|
||||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.types.AbstractBuiltInTypeTest
|
import org.jetbrains.kotlin.analysis.api.impl.base.test.cases.types.AbstractBuiltInTypeTest
|
||||||
@@ -69,8 +68,7 @@ import org.jetbrains.kotlin.generators.tests.analysis.api.dsl.*
|
|||||||
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
|
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
|
||||||
|
|
||||||
internal fun AnalysisApiTestGroup.generateAnalysisApiTests() {
|
internal fun AnalysisApiTestGroup.generateAnalysisApiTests() {
|
||||||
test(
|
test<AbstractReferenceResolveTest>(
|
||||||
AbstractReferenceResolveTest::class,
|
|
||||||
filter = testModuleKindIs(TestModuleKind.Source, TestModuleKind.ScriptSource, TestModuleKind.LibrarySource) and
|
filter = testModuleKindIs(TestModuleKind.Source, TestModuleKind.ScriptSource, TestModuleKind.LibrarySource) and
|
||||||
analysisApiModeIs(AnalysisApiMode.Ide, AnalysisApiMode.Standalone),
|
analysisApiModeIs(AnalysisApiMode.Ide, AnalysisApiMode.Standalone),
|
||||||
) { data ->
|
) { data ->
|
||||||
@@ -91,8 +89,7 @@ internal fun AnalysisApiTestGroup.generateAnalysisApiTests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractDanglingFileReferenceResolveTest>(
|
||||||
AbstractDanglingFileReferenceResolveTest::class,
|
|
||||||
filter = frontendIs(FrontendKind.Fir)
|
filter = frontendIs(FrontendKind.Fir)
|
||||||
and testModuleKindIs(TestModuleKind.Source, TestModuleKind.LibrarySource)
|
and testModuleKindIs(TestModuleKind.Source, TestModuleKind.LibrarySource)
|
||||||
) {
|
) {
|
||||||
@@ -106,15 +103,15 @@ internal fun AnalysisApiTestGroup.generateAnalysisApiTests() {
|
|||||||
and analysisSessionModeIs(AnalysisSessionMode.Normal)
|
and analysisSessionModeIs(AnalysisSessionMode.Normal)
|
||||||
and analysisApiModeIs(AnalysisApiMode.Ide)
|
and analysisApiModeIs(AnalysisApiMode.Ide)
|
||||||
) {
|
) {
|
||||||
test(AbstractCompilerFacilityTest::class, filter = testModuleKindIs(TestModuleKind.Source, TestModuleKind.LibrarySource)) {
|
test<AbstractCompilerFacilityTest>(filter = testModuleKindIs(TestModuleKind.Source, TestModuleKind.LibrarySource)) {
|
||||||
model("compilation", pattern = TestGeneratorUtil.KT)
|
model("compilation", pattern = TestGeneratorUtil.KT)
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractMultiModuleCompilerFacilityTest::class, filter = testModuleKindIs(TestModuleKind.Source)) {
|
test<AbstractMultiModuleCompilerFacilityTest>(filter = testModuleKindIs(TestModuleKind.Source)) {
|
||||||
model("compilationMultiModule", pattern = TestGeneratorUtil.KT)
|
model("compilationMultiModule", pattern = TestGeneratorUtil.KT)
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractFirPluginPrototypeMultiModuleCompilerFacilityTest::class, filter = testModuleKindIs(TestModuleKind.Source)) {
|
test<AbstractFirPluginPrototypeMultiModuleCompilerFacilityTest>(filter = testModuleKindIs(TestModuleKind.Source)) {
|
||||||
model("firPluginPrototypeMultiModule", pattern = TestGeneratorUtil.KT)
|
model("firPluginPrototypeMultiModule", pattern = TestGeneratorUtil.KT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +136,7 @@ private fun AnalysisApiTestGroup.generateResolveExtensionsTests() {
|
|||||||
frontendIs(FrontendKind.Fir) and
|
frontendIs(FrontendKind.Fir) and
|
||||||
testModuleKindIs(TestModuleKind.Source)
|
testModuleKindIs(TestModuleKind.Source)
|
||||||
) {
|
) {
|
||||||
test(AbstractReferenceResolveWithResolveExtensionTest::class) {
|
test<AbstractReferenceResolveWithResolveExtensionTest> {
|
||||||
model(it, "referenceResolve")
|
model(it, "referenceResolve")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,29 +144,27 @@ private fun AnalysisApiTestGroup.generateResolveExtensionsTests() {
|
|||||||
|
|
||||||
private fun AnalysisApiTestGroup.generateAnalysisApiNonComponentsTests() {
|
private fun AnalysisApiTestGroup.generateAnalysisApiNonComponentsTests() {
|
||||||
group("symbols", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
group("symbols", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(AbstractSymbolByPsiTest::class) {
|
test<AbstractSymbolByPsiTest> {
|
||||||
model(it, "symbolByPsi")
|
model(it, "symbolByPsi")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractSymbolByJavaPsiTest::class, filter = frontendIs(FrontendKind.Fir)) {
|
test<AbstractSymbolByJavaPsiTest>(filter = frontendIs(FrontendKind.Fir)) {
|
||||||
model(it, "symbolByJavaPsi")
|
model(it, "symbolByJavaPsi")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractSingleSymbolByPsiTest::class) {
|
test<AbstractSingleSymbolByPsiTest> {
|
||||||
model(it, "singleSymbolByPsi")
|
model(it, "singleSymbolByPsi")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractSymbolRestoreFromDifferentModuleTest::class) {
|
test<AbstractSymbolRestoreFromDifferentModuleTest> {
|
||||||
model(it, "symbolRestoreFromDifferentModule")
|
model(it, "symbolRestoreFromDifferentModule")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractMultiModuleSymbolByPsiTest::class) {
|
test<AbstractMultiModuleSymbolByPsiTest> {
|
||||||
model(it, "multiModuleSymbolByPsi")
|
model(it, "multiModuleSymbolByPsi")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractSymbolByFqNameTest> {
|
||||||
AbstractSymbolByFqNameTest::class
|
|
||||||
) {
|
|
||||||
when (it.analysisApiMode) {
|
when (it.analysisApiMode) {
|
||||||
AnalysisApiMode.Ide ->
|
AnalysisApiMode.Ide ->
|
||||||
model(it, "symbolByFqName")
|
model(it, "symbolByFqName")
|
||||||
@@ -178,7 +173,7 @@ private fun AnalysisApiTestGroup.generateAnalysisApiNonComponentsTests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractSymbolByReferenceTest::class) {
|
test<AbstractSymbolByReferenceTest> {
|
||||||
when (it.analysisApiMode) {
|
when (it.analysisApiMode) {
|
||||||
AnalysisApiMode.Ide ->
|
AnalysisApiMode.Ide ->
|
||||||
model(it, "symbolByReference")
|
model(it, "symbolByReference")
|
||||||
@@ -189,44 +184,42 @@ private fun AnalysisApiTestGroup.generateAnalysisApiNonComponentsTests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group("types", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
group("types", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(AbstractTypeByDeclarationReturnTypeTest::class) {
|
test<AbstractTypeByDeclarationReturnTypeTest> {
|
||||||
model(it, "byDeclarationReturnType")
|
model(it, "byDeclarationReturnType")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractBuiltInTypeTest::class) {
|
test<AbstractBuiltInTypeTest> {
|
||||||
model(it, "builtins")
|
model(it, "builtins")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
group("annotations") {
|
group("annotations") {
|
||||||
test(AbstractAnalysisApiAnnotationsOnTypesTest::class) {
|
test<AbstractAnalysisApiAnnotationsOnTypesTest> {
|
||||||
model(it, "annotationsOnTypes")
|
model(it, "annotationsOnTypes")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiAnnotationsOnDeclarationsTest::class) {
|
test<AbstractAnalysisApiAnnotationsOnDeclarationsTest> {
|
||||||
model(it, "annotationsOnDeclaration")
|
model(it, "annotationsOnDeclaration")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiSpecificAnnotationOnDeclarationTest::class) {
|
test<AbstractAnalysisApiSpecificAnnotationOnDeclarationTest> {
|
||||||
model(it, "specificAnnotations")
|
model(it, "specificAnnotations")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractAnalysisApiAnnotationsOnFilesTest>(
|
||||||
AbstractAnalysisApiAnnotationsOnFilesTest::class,
|
|
||||||
filter = analysisSessionModeIs(AnalysisSessionMode.Normal),
|
filter = analysisSessionModeIs(AnalysisSessionMode.Normal),
|
||||||
) {
|
) {
|
||||||
model(it, "annotationsOnFiles")
|
model(it, "annotationsOnFiles")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiAnnotationsOnDeclarationsWithMetaTest::class) {
|
test<AbstractAnalysisApiAnnotationsOnDeclarationsWithMetaTest> {
|
||||||
model(it, "metaAnnotations")
|
model(it, "metaAnnotations")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group("imports", filter = frontendIs(FrontendKind.Fir)) {
|
group("imports", filter = frontendIs(FrontendKind.Fir)) {
|
||||||
test(
|
test<AbstractReferenceImportAliasTest>(
|
||||||
AbstractReferenceImportAliasTest::class,
|
|
||||||
filter = analysisSessionModeIs(AnalysisSessionMode.Normal)
|
filter = analysisSessionModeIs(AnalysisSessionMode.Normal)
|
||||||
) {
|
) {
|
||||||
model(it, "importAliases")
|
model(it, "importAliases")
|
||||||
@@ -234,7 +227,7 @@ private fun AnalysisApiTestGroup.generateAnalysisApiNonComponentsTests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group("substitutors", filter = frontendIs(FrontendKind.Fir)) {
|
group("substitutors", filter = frontendIs(FrontendKind.Fir)) {
|
||||||
test(AbstractAnalysisApiSubstitutorsTest::class) {
|
test<AbstractAnalysisApiSubstitutorsTest> {
|
||||||
model(it, "typeSubstitution")
|
model(it, "typeSubstitution")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,15 +235,13 @@ private fun AnalysisApiTestGroup.generateAnalysisApiNonComponentsTests() {
|
|||||||
|
|
||||||
private fun AnalysisApiTestGroup.generateAnalysisApiStandaloneTests() {
|
private fun AnalysisApiTestGroup.generateAnalysisApiStandaloneTests() {
|
||||||
group("standalone") {
|
group("standalone") {
|
||||||
test(
|
test<AbstractPsiDeclarationProviderTest>(
|
||||||
AbstractPsiDeclarationProviderTest::class,
|
|
||||||
filter = testModuleKindIs(TestModuleKind.Source)
|
filter = testModuleKindIs(TestModuleKind.Source)
|
||||||
) {
|
) {
|
||||||
model(it, "source")
|
model(it, "source")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractPsiDeclarationProviderTest>(
|
||||||
AbstractPsiDeclarationProviderTest::class,
|
|
||||||
filter = testModuleKindIs(TestModuleKind.LibraryBinaryDecompiled)
|
filter = testModuleKindIs(TestModuleKind.LibraryBinaryDecompiled)
|
||||||
) {
|
) {
|
||||||
model(it, "binary")
|
model(it, "binary")
|
||||||
@@ -260,7 +251,7 @@ private fun AnalysisApiTestGroup.generateAnalysisApiStandaloneTests() {
|
|||||||
|
|
||||||
private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
||||||
component("callResolver", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
component("callResolver", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(AbstractResolveCallTest::class) {
|
test<AbstractResolveCallTest> {
|
||||||
when (it.analysisApiMode) {
|
when (it.analysisApiMode) {
|
||||||
AnalysisApiMode.Ide ->
|
AnalysisApiMode.Ide ->
|
||||||
model(it, "resolveCall")
|
model(it, "resolveCall")
|
||||||
@@ -269,15 +260,13 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractResolveCandidatesTest> {
|
||||||
AbstractResolveCandidatesTest::class
|
|
||||||
) {
|
|
||||||
model(it, "resolveCandidates")
|
model(it, "resolveCandidates")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("multiModuleCallResolver", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
component("multiModuleCallResolver", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(AbstractMultiModuleResolveCallTest::class, filter = frontendIs(FrontendKind.Fir)) {
|
test<AbstractMultiModuleResolveCallTest>(filter = frontendIs(FrontendKind.Fir)) {
|
||||||
when (it.analysisApiMode) {
|
when (it.analysisApiMode) {
|
||||||
AnalysisApiMode.Ide ->
|
AnalysisApiMode.Ide ->
|
||||||
model(it, "resolveCall")
|
model(it, "resolveCall")
|
||||||
@@ -288,64 +277,59 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
component("compileTimeConstantProvider") {
|
component("compileTimeConstantProvider") {
|
||||||
test(AbstractCompileTimeConstantEvaluatorTest::class) {
|
test<AbstractCompileTimeConstantEvaluatorTest> {
|
||||||
model(it, "evaluate")
|
model(it, "evaluate")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("expressionInfoProvider") {
|
component("expressionInfoProvider") {
|
||||||
test(AbstractWhenMissingCasesTest::class) {
|
test<AbstractWhenMissingCasesTest> {
|
||||||
model(it, "whenMissingCases")
|
model(it, "whenMissingCases")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractReturnTargetSymbolTest::class) {
|
test<AbstractReturnTargetSymbolTest> {
|
||||||
model(it, "returnExpressionTargetSymbol")
|
model(it, "returnExpressionTargetSymbol")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractIsUsedAsExpressionTest::class) {
|
test<AbstractIsUsedAsExpressionTest> {
|
||||||
model(it, "isUsedAsExpression")
|
model(it, "isUsedAsExpression")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("referenceShortener", filter = frontendIs(FrontendKind.Fir) and analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
component("referenceShortener", filter = frontendIs(FrontendKind.Fir) and analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(AbstractReferenceShortenerTest::class) {
|
test<AbstractReferenceShortenerTest> {
|
||||||
model(it, "shortenRange")
|
model(it, "shortenRange")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractReferenceShortenerForWholeFileTest::class) {
|
test<AbstractReferenceShortenerForWholeFileTest> {
|
||||||
model(it, "shortenWholeFile")
|
model(it, "shortenWholeFile")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("expressionTypeProvider") {
|
component("expressionTypeProvider") {
|
||||||
test(AbstractExpectedExpressionTypeTest::class) {
|
test<AbstractExpectedExpressionTypeTest> {
|
||||||
model(it, "expectedExpressionType")
|
model(it, "expectedExpressionType")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractHLExpressionTypeTest> {
|
||||||
AbstractHLExpressionTypeTest::class
|
|
||||||
) {
|
|
||||||
model(it, "expressionType")
|
model(it, "expressionType")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractDeclarationReturnTypeTest> {
|
||||||
AbstractDeclarationReturnTypeTest::class
|
|
||||||
) {
|
|
||||||
model(it, "declarationReturnType")
|
model(it, "declarationReturnType")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("diagnosticsProvider", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
component("diagnosticsProvider", filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(AbstractCollectDiagnosticsTest::class) {
|
test<AbstractCollectDiagnosticsTest> {
|
||||||
model(it, "diagnostics")
|
model(it, "diagnostics")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractDanglingFileCollectDiagnosticsTest::class, filter = frontendIs(FrontendKind.Fir)) {
|
test<AbstractDanglingFileCollectDiagnosticsTest>(filter = frontendIs(FrontendKind.Fir)) {
|
||||||
model(it, "diagnostics")
|
model(it, "diagnostics")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractCodeFragmentCollectDiagnosticsTest>(
|
||||||
AbstractCodeFragmentCollectDiagnosticsTest::class,
|
|
||||||
filter = testModuleKindIs(TestModuleKind.Source) and frontendIs(FrontendKind.Fir),
|
filter = testModuleKindIs(TestModuleKind.Source) and frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
model("codeFragmentDiagnostics", pattern = TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME)
|
model("codeFragmentDiagnostics", pattern = TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME)
|
||||||
@@ -354,26 +338,25 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
|||||||
|
|
||||||
// for K1, symbols do not have a proper equality implementation, so the tests are failing
|
// for K1, symbols do not have a proper equality implementation, so the tests are failing
|
||||||
component("containingDeclarationProvider", filter = frontendIs(FrontendKind.Fir)) {
|
component("containingDeclarationProvider", filter = frontendIs(FrontendKind.Fir)) {
|
||||||
test(AbstractContainingDeclarationProviderByPsiTest::class) {
|
test<AbstractContainingDeclarationProviderByPsiTest> {
|
||||||
model(it, "containingDeclarationByPsi")
|
model(it, "containingDeclarationByPsi")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractContainingDeclarationProviderByMemberScopeTest::class) {
|
test<AbstractContainingDeclarationProviderByMemberScopeTest> {
|
||||||
model(it, "containingDeclarationFromMemberScope")
|
model(it, "containingDeclarationFromMemberScope")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractContainingDeclarationProviderForSetterParameterTest::class) {
|
test<AbstractContainingDeclarationProviderForSetterParameterTest> {
|
||||||
model(it, "containingDeclarationForSetterParameter")
|
model(it, "containingDeclarationForSetterParameter")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractContainingDeclarationProviderByDelegatedMemberScopeTest::class) {
|
test<AbstractContainingDeclarationProviderByDelegatedMemberScopeTest> {
|
||||||
model(it, "containingDeclarationByDelegatedMemberScope")
|
model(it, "containingDeclarationByDelegatedMemberScope")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("importOptimizer") {
|
component("importOptimizer") {
|
||||||
test(
|
test<AbstractAnalysisApiImportOptimizerTest>(
|
||||||
AbstractAnalysisApiImportOptimizerTest::class,
|
|
||||||
filter = analysisSessionModeIs(AnalysisSessionMode.Normal) and frontendIs(FrontendKind.Fir),
|
filter = analysisSessionModeIs(AnalysisSessionMode.Normal) and frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
model(it, "analyseImports")
|
model(it, "analyseImports")
|
||||||
@@ -381,114 +364,114 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
component("multiplatformInfoProvider") {
|
component("multiplatformInfoProvider") {
|
||||||
test(AbstractExpectForActualTest::class) {
|
test<AbstractExpectForActualTest> {
|
||||||
model(it, "expectForActual")
|
model(it, "expectForActual")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("psiTypeProvider") {
|
component("psiTypeProvider") {
|
||||||
test(AbstractAnalysisApiPsiTypeProviderTest::class) {
|
test<AbstractAnalysisApiPsiTypeProviderTest> {
|
||||||
model(it, "psiType/forDeclaration")
|
model(it, "psiType/forDeclaration")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiExpressionPsiTypeProviderTest::class, filter = frontendIs(FrontendKind.Fir)) {
|
test<AbstractAnalysisApiExpressionPsiTypeProviderTest>(filter = frontendIs(FrontendKind.Fir)) {
|
||||||
model(it, "psiType/forExpression")
|
model(it, "psiType/forExpression")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiKtTypeByPsiTypeProviderTest::class, filter = frontendIs(FrontendKind.Fir)) {
|
test<AbstractAnalysisApiKtTypeByPsiTypeProviderTest>(filter = frontendIs(FrontendKind.Fir)) {
|
||||||
model(it, "psiType/asKtType")
|
model(it, "psiType/asKtType")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("resolveExtensionInfoProvider", filter = frontendIs(FrontendKind.Fir)) {
|
component("resolveExtensionInfoProvider", filter = frontendIs(FrontendKind.Fir)) {
|
||||||
test(AbstractResolveExtensionInfoProviderTest::class) {
|
test<AbstractResolveExtensionInfoProviderTest> {
|
||||||
model(it, "extensionScopeWithPsi")
|
model(it, "extensionScopeWithPsi")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("smartCastProvider") {
|
component("smartCastProvider") {
|
||||||
test(AbstractHLSmartCastInfoTest::class) {
|
test<AbstractHLSmartCastInfoTest> {
|
||||||
model(it, "smartCastInfo")
|
model(it, "smartCastInfo")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("symbolDeclarationOverridesProvider") {
|
component("symbolDeclarationOverridesProvider") {
|
||||||
test(AbstractOverriddenDeclarationProviderTest::class) {
|
test<AbstractOverriddenDeclarationProviderTest> {
|
||||||
model(it, "overriddenSymbols")
|
model(it, "overriddenSymbols")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractIsSubclassOfTest::class) {
|
test<AbstractIsSubclassOfTest> {
|
||||||
model(it, "isSubclassOf")
|
model(it, "isSubclassOf")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("symbolDeclarationRenderer") {
|
component("symbolDeclarationRenderer") {
|
||||||
test(AbstractRendererTest::class) {
|
test<AbstractRendererTest> {
|
||||||
model(it, "renderDeclaration")
|
model(it, "renderDeclaration")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractSymbolRenderingByReferenceTest::class, analysisApiModeIs(AnalysisApiMode.Ide, AnalysisApiMode.Standalone)) {
|
test<AbstractSymbolRenderingByReferenceTest>(analysisApiModeIs(AnalysisApiMode.Ide, AnalysisApiMode.Standalone)) {
|
||||||
model(it, "symbolRenderingByReference")
|
model(it, "symbolRenderingByReference")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("symbolInfoProvider") {
|
component("symbolInfoProvider") {
|
||||||
test(AbstractAnnotationApplicableTargetsTest::class) {
|
test<AbstractAnnotationApplicableTargetsTest> {
|
||||||
model(it, "annotationApplicableTargets")
|
model(it, "annotationApplicableTargets")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("typeCreator") {
|
component("typeCreator") {
|
||||||
test(AbstractTypeParameterTypeTest::class) {
|
test<AbstractTypeParameterTypeTest> {
|
||||||
model(it, "typeParameter")
|
model(it, "typeParameter")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractBuildClassTypeTest::class, filter = analysisSessionModeIs(AnalysisSessionMode.Normal)/*no non-file context element*/) {
|
test<AbstractBuildClassTypeTest>(filter = analysisSessionModeIs(AnalysisSessionMode.Normal)/*no non-file context element*/) {
|
||||||
model(it, "classType")
|
model(it, "classType")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("typeInfoProvider") {
|
component("typeInfoProvider") {
|
||||||
test(AbstractFunctionClassKindTest::class) {
|
test<AbstractFunctionClassKindTest> {
|
||||||
model(it, "functionClassKind")
|
model(it, "functionClassKind")
|
||||||
}
|
}
|
||||||
test(AbstractAnalysisApiGetSuperTypesTest::class, filter = frontendIs(FrontendKind.Fir)) {
|
test<AbstractAnalysisApiGetSuperTypesTest>(filter = frontendIs(FrontendKind.Fir)) {
|
||||||
model(it, "superTypes")
|
model(it, "superTypes")
|
||||||
}
|
}
|
||||||
test(AbstractDoubleColonReceiverTypeTest::class) {
|
test<AbstractDoubleColonReceiverTypeTest> {
|
||||||
model(it, "doubleColonReceiverType")
|
model(it, "doubleColonReceiverType")
|
||||||
}
|
}
|
||||||
test(AbstractIsDenotableTest::class) {
|
test<AbstractIsDenotableTest> {
|
||||||
model(it, "isDenotable", excludedPattern = ".*\\.descriptors\\.kt$")
|
model(it, "isDenotable", excludedPattern = ".*\\.descriptors\\.kt$")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("typeProvider") {
|
component("typeProvider") {
|
||||||
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(AbstractHasCommonSubtypeTest::class) {
|
test<AbstractHasCommonSubtypeTest> {
|
||||||
model(it, "haveCommonSubtype")
|
model(it, "haveCommonSubtype")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
test(AbstractTypeReferenceTest::class) {
|
test<AbstractTypeReferenceTest> {
|
||||||
model(it, "typeReference")
|
model(it, "typeReference")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("signatureSubstitution") {
|
component("signatureSubstitution") {
|
||||||
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal) and frontendIs(FrontendKind.Fir)) {
|
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal) and frontendIs(FrontendKind.Fir)) {
|
||||||
test(AbstractAnalysisApiSymbolAsSignatureTest::class) {
|
test<AbstractAnalysisApiSymbolAsSignatureTest> {
|
||||||
model(it, "symbolAsSignature")
|
model(it, "symbolAsSignature")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiSymbolSubstitutionTest::class) {
|
test<AbstractAnalysisApiSymbolSubstitutionTest> {
|
||||||
model(it, "symbolSubstitution")
|
model(it, "symbolSubstitution")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiSignatureSubstitutionTest::class) {
|
test<AbstractAnalysisApiSignatureSubstitutionTest> {
|
||||||
model(it, "signatureSubstitution")
|
model(it, "signatureSubstitution")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractAnalysisApiSignatureContractsTest::class) {
|
test<AbstractAnalysisApiSignatureContractsTest> {
|
||||||
model(it, "signatureContracts")
|
model(it, "signatureContracts")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,50 +479,48 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
|||||||
|
|
||||||
component("substitutorFactory") {
|
component("substitutorFactory") {
|
||||||
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal) and frontendIs(FrontendKind.Fir)) {
|
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal) and frontendIs(FrontendKind.Fir)) {
|
||||||
test(AbstractSubstitutorBuilderTest::class) {
|
test<AbstractSubstitutorBuilderTest> {
|
||||||
model(it, "substitutorBuilder")
|
model(it, "substitutorBuilder")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("substitutorProvider", filter = frontendIs(FrontendKind.Fir)) {
|
component("substitutorProvider", filter = frontendIs(FrontendKind.Fir)) {
|
||||||
test(AbstractCreateInheritanceTypeSubstitutorTest::class) {
|
test<AbstractCreateInheritanceTypeSubstitutorTest> {
|
||||||
model(it, "createInheritanceTypeSubstitutor")
|
model(it, "createInheritanceTypeSubstitutor")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
component("referenceResolveProvider") {
|
component("referenceResolveProvider") {
|
||||||
test(AbstractIsImplicitCompanionReferenceTest::class) {
|
test<AbstractIsImplicitCompanionReferenceTest> {
|
||||||
model(it, "isImplicitReferenceToCompanion")
|
model(it, "isImplicitReferenceToCompanion")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("scopeProvider") {
|
component("scopeProvider") {
|
||||||
group(filter = frontendIs(FrontendKind.Fir)) {
|
group(filter = frontendIs(FrontendKind.Fir)) {
|
||||||
test(AbstractTypeScopeTest::class) {
|
test<AbstractTypeScopeTest> {
|
||||||
model(it, "typeScope")
|
model(it, "typeScope")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractScopeContextForPositionTest::class) {
|
test<AbstractScopeContextForPositionTest> {
|
||||||
model(it, "scopeContextForPosition")
|
model(it, "scopeContextForPosition")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractFileImportingScopeContextTest::class) {
|
test<AbstractFileImportingScopeContextTest> {
|
||||||
model(it, "importingScopeContext")
|
model(it, "importingScopeContext")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
group(filter = analysisSessionModeIs(AnalysisSessionMode.Normal)) {
|
||||||
test(
|
test<AbstractSubstitutionOverridesUnwrappingTest>(
|
||||||
AbstractSubstitutionOverridesUnwrappingTest::class,
|
|
||||||
filter = frontendIs(FrontendKind.Fir),
|
filter = frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
model(it, "substitutionOverridesUnwrapping")
|
model(it, "substitutionOverridesUnwrapping")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractMemberScopeTest>(
|
||||||
AbstractMemberScopeTest::class,
|
|
||||||
filter = frontendIs(FrontendKind.Fir),
|
filter = frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
when (it.analysisApiMode) {
|
when (it.analysisApiMode) {
|
||||||
@@ -550,37 +531,33 @@ private fun AnalysisApiTestGroup.generateAnalysisApiComponentsTests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractStaticMemberScopeTest>(
|
||||||
AbstractStaticMemberScopeTest::class,
|
|
||||||
filter = frontendIs(FrontendKind.Fir),
|
filter = frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
model(it, "staticMemberScope")
|
model(it, "staticMemberScope")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractFileScopeTest::class) {
|
test<AbstractFileScopeTest> {
|
||||||
model(it, "fileScopeTest")
|
model(it, "fileScopeTest")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(AbstractDelegateMemberScopeTest::class) {
|
test<AbstractDelegateMemberScopeTest> {
|
||||||
model(it, "delegatedMemberScope")
|
model(it, "delegatedMemberScope")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractDeclaredMemberScopeTest>(
|
||||||
AbstractDeclaredMemberScopeTest::class,
|
|
||||||
filter = frontendIs(FrontendKind.Fir),
|
filter = frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
model(it, "declaredMemberScope")
|
model(it, "declaredMemberScope")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractStaticDeclaredMemberScopeTest>(
|
||||||
AbstractStaticDeclaredMemberScopeTest::class,
|
|
||||||
filter = frontendIs(FrontendKind.Fir),
|
filter = frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
model(it, "staticDeclaredMemberScope")
|
model(it, "staticDeclaredMemberScope")
|
||||||
}
|
}
|
||||||
|
|
||||||
test(
|
test<AbstractCombinedDeclaredMemberScopeTest>(
|
||||||
AbstractCombinedDeclaredMemberScopeTest::class,
|
|
||||||
filter = frontendIs(FrontendKind.Fir),
|
filter = frontendIs(FrontendKind.Fir),
|
||||||
) {
|
) {
|
||||||
model(it, "combinedDeclaredMemberScope")
|
model(it, "combinedDeclaredMemberScope")
|
||||||
|
|||||||
+13
-7
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.generators.TestGroup
|
|||||||
import org.jetbrains.kotlin.generators.TestGroupSuite
|
import org.jetbrains.kotlin.generators.TestGroupSuite
|
||||||
import org.jetbrains.kotlin.generators.getDefaultSuiteTestClassName
|
import org.jetbrains.kotlin.generators.getDefaultSuiteTestClassName
|
||||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
class AnalysisApiTestGroup(
|
class AnalysisApiTestGroup(
|
||||||
private val generator: AnalysisApiTestGenerator,
|
private val generator: AnalysisApiTestGenerator,
|
||||||
@@ -31,8 +30,15 @@ class AnalysisApiTestGroup(
|
|||||||
generator.suite.init()
|
generator.suite.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline fun <reified T : Any> test(
|
||||||
|
noinline filter: TestFilter = { true },
|
||||||
|
noinline init: TestGroup.TestClass.(data: AnalysisApiTestConfiguratorFactoryData) -> Unit,
|
||||||
|
) {
|
||||||
|
test(T::class.java, filter, init)
|
||||||
|
}
|
||||||
|
|
||||||
fun test(
|
fun test(
|
||||||
testClass: KClass<*>,
|
testClass: Class<*>,
|
||||||
filter: TestFilter = { true },
|
filter: TestFilter = { true },
|
||||||
init: TestGroup.TestClass.(data: AnalysisApiTestConfiguratorFactoryData) -> Unit,
|
init: TestGroup.TestClass.(data: AnalysisApiTestConfiguratorFactoryData) -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -69,7 +75,7 @@ internal fun TestGroup.TestClass.model(
|
|||||||
|
|
||||||
private fun TestGroup.analysisApiTestClass(
|
private fun TestGroup.analysisApiTestClass(
|
||||||
data: AnalysisApiTestConfiguratorFactoryData,
|
data: AnalysisApiTestConfiguratorFactoryData,
|
||||||
testClass: KClass<*>,
|
testClass: Class<*>,
|
||||||
init: TestGroup.TestClass.(data: AnalysisApiTestConfiguratorFactoryData) -> Unit
|
init: TestGroup.TestClass.(data: AnalysisApiTestConfiguratorFactoryData) -> Unit
|
||||||
) {
|
) {
|
||||||
val factory = AnalysisApiConfiguratorFactoryProvider.getFactory(data) ?: return
|
val factory = AnalysisApiConfiguratorFactoryProvider.getFactory(data) ?: return
|
||||||
@@ -79,10 +85,10 @@ private fun TestGroup.analysisApiTestClass(
|
|||||||
val suiteTestClassName = buildString {
|
val suiteTestClassName = buildString {
|
||||||
append(fullPackage)
|
append(fullPackage)
|
||||||
append(getTestNameSuffix(data))
|
append(getTestNameSuffix(data))
|
||||||
append(getDefaultSuiteTestClassName(testClass.java.simpleName))
|
append(getDefaultSuiteTestClassName(testClass.simpleName))
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultSuiteTestClassName(testClass.java.simpleName)
|
getDefaultSuiteTestClassName(testClass.simpleName)
|
||||||
|
|
||||||
|
|
||||||
testClass(
|
testClass(
|
||||||
@@ -104,7 +110,7 @@ private fun getTestNameSuffix(data: AnalysisApiTestConfiguratorFactoryData): Str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPackageName(data: AnalysisApiTestConfiguratorFactoryData, testClass: KClass<*>): String {
|
private fun getPackageName(data: AnalysisApiTestConfiguratorFactoryData, testClass: Class<*>): String {
|
||||||
val basePrefix = buildString {
|
val basePrefix = buildString {
|
||||||
append("org.jetbrains.kotlin.analysis.api.")
|
append("org.jetbrains.kotlin.analysis.api.")
|
||||||
if (data.analysisApiMode == AnalysisApiMode.Standalone) {
|
if (data.analysisApiMode == AnalysisApiMode.Standalone) {
|
||||||
@@ -113,7 +119,7 @@ private fun getPackageName(data: AnalysisApiTestConfiguratorFactoryData, testCla
|
|||||||
append(data.frontend.suffix.lowercase())
|
append(data.frontend.suffix.lowercase())
|
||||||
append(".test.cases.generated")
|
append(".test.cases.generated")
|
||||||
}
|
}
|
||||||
val packagePrefix = "cases." + testClass.java.name
|
val packagePrefix = "cases." + testClass.name
|
||||||
.substringAfter("test.cases.")
|
.substringAfter("test.cases.")
|
||||||
.substringBeforeLast('.', "")
|
.substringBeforeLast('.', "")
|
||||||
|
|
||||||
|
|||||||
+7
-12
@@ -9,17 +9,13 @@ import org.jetbrains.kotlin.generators.model.DefaultTargetBackendComputer
|
|||||||
import org.jetbrains.kotlin.generators.model.TargetBackendComputer
|
import org.jetbrains.kotlin.generators.model.TargetBackendComputer
|
||||||
import org.jetbrains.kotlin.test.TargetBackend
|
import org.jetbrains.kotlin.test.TargetBackend
|
||||||
import org.jetbrains.kotlin.test.runners.RunnerWithTargetBackendForTestGeneratorMarker
|
import org.jetbrains.kotlin.test.runners.RunnerWithTargetBackendForTestGeneratorMarker
|
||||||
import kotlin.reflect.KClass
|
import java.lang.reflect.Modifier
|
||||||
import kotlin.reflect.full.createInstance
|
|
||||||
import kotlin.reflect.full.declaredMemberProperties
|
|
||||||
import kotlin.reflect.full.isSubclassOf
|
|
||||||
|
|
||||||
object ReflectionBasedTargetBackendComputer : TargetBackendComputer {
|
object ReflectionBasedTargetBackendComputer : TargetBackendComputer {
|
||||||
private val runnerMarkerKClass = RunnerWithTargetBackendForTestGeneratorMarker::class
|
private val runnerMarkerKClass = RunnerWithTargetBackendForTestGeneratorMarker::class.java
|
||||||
private const val TARGET_BACKEND_PROPERTY_NAME = "targetBackend"
|
|
||||||
|
|
||||||
override fun compute(definedTargetBackend: TargetBackend?, testKClass: KClass<*>): TargetBackend {
|
override fun compute(definedTargetBackend: TargetBackend?, testKClass: Class<*>): TargetBackend {
|
||||||
if (!testKClass.isSubclassOf(runnerMarkerKClass)) return DefaultTargetBackendComputer.compute(definedTargetBackend, testKClass)
|
if (!runnerMarkerKClass.isAssignableFrom(testKClass)) return DefaultTargetBackendComputer.compute(definedTargetBackend, testKClass)
|
||||||
require(definedTargetBackend == null) {
|
require(definedTargetBackend == null) {
|
||||||
"""
|
"""
|
||||||
Test ${testKClass.simpleName} is inheritor of ${runnerMarkerKClass.simpleName} which means that
|
Test ${testKClass.simpleName} is inheritor of ${runnerMarkerKClass.simpleName} which means that
|
||||||
@@ -27,14 +23,13 @@ object ReflectionBasedTargetBackendComputer : TargetBackendComputer {
|
|||||||
read from test runner class itself
|
read from test runner class itself
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
require(testKClass.isOpen) {
|
require(!Modifier.isFinal(testKClass.modifiers)) {
|
||||||
"""
|
"""
|
||||||
Test runner ${testKClass.simpleName} which inherits from ${runnerMarkerKClass.simpleName} and used as base class
|
Test runner ${testKClass.simpleName} which inherits from ${runnerMarkerKClass.simpleName} and used as base class
|
||||||
for real test should have `open` modality
|
for real test should have `open` modality
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
val instance = testKClass.createInstance() as RunnerWithTargetBackendForTestGeneratorMarker
|
val instance = testKClass.newInstance() as RunnerWithTargetBackendForTestGeneratorMarker
|
||||||
val kProperty = runnerMarkerKClass.declaredMemberProperties.single { it.name == TARGET_BACKEND_PROPERTY_NAME }
|
return instance.targetBackend
|
||||||
return kProperty.get(instance) as TargetBackend
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-7
@@ -10,9 +10,7 @@ import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
|
|||||||
import org.jetbrains.kotlin.generators.util.extractTagsFromDirectory
|
import org.jetbrains.kotlin.generators.util.extractTagsFromDirectory
|
||||||
import org.jetbrains.kotlin.test.TargetBackend
|
import org.jetbrains.kotlin.test.TargetBackend
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.concurrent.ForkJoinPool
|
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
fun testGroupSuite(
|
fun testGroupSuite(
|
||||||
init: TestGroupSuite.() -> Unit
|
init: TestGroupSuite.() -> Unit
|
||||||
@@ -68,13 +66,13 @@ class TestGroup(
|
|||||||
annotations: List<AnnotationModel> = emptyList(),
|
annotations: List<AnnotationModel> = emptyList(),
|
||||||
noinline init: TestClass.() -> Unit
|
noinline init: TestClass.() -> Unit
|
||||||
) {
|
) {
|
||||||
val testKClass = T::class
|
val testKClass = T::class.java
|
||||||
testClass(testKClass, testKClass.java.name, suiteTestClassName, useJunit4, annotations, init)
|
testClass(testKClass, testKClass.name, suiteTestClassName, useJunit4, annotations, init)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testClass(
|
fun testClass(
|
||||||
testKClass: KClass<*>,
|
testKClass: Class<*>,
|
||||||
baseTestClassName: String = testKClass.java.name,
|
baseTestClassName: String = testKClass.name,
|
||||||
suiteTestClassName: String = getDefaultSuiteTestClassName(baseTestClassName.substringAfterLast('.')),
|
suiteTestClassName: String = getDefaultSuiteTestClassName(baseTestClassName.substringAfterLast('.')),
|
||||||
useJunit4: Boolean,
|
useJunit4: Boolean,
|
||||||
annotations: List<AnnotationModel> = emptyList(),
|
annotations: List<AnnotationModel> = emptyList(),
|
||||||
@@ -84,7 +82,7 @@ class TestGroup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
inner class TestClass(
|
inner class TestClass(
|
||||||
val testKClass: KClass<*>,
|
val testKClass: Class<*>,
|
||||||
val baseTestClassName: String,
|
val baseTestClassName: String,
|
||||||
val suiteTestClassName: String,
|
val suiteTestClassName: String,
|
||||||
val useJunit4: Boolean,
|
val useJunit4: Boolean,
|
||||||
|
|||||||
+2
-3
@@ -6,14 +6,13 @@
|
|||||||
package org.jetbrains.kotlin.generators.model
|
package org.jetbrains.kotlin.generators.model
|
||||||
|
|
||||||
import org.jetbrains.kotlin.test.TargetBackend
|
import org.jetbrains.kotlin.test.TargetBackend
|
||||||
import kotlin.reflect.KClass
|
|
||||||
|
|
||||||
fun interface TargetBackendComputer {
|
fun interface TargetBackendComputer {
|
||||||
fun compute(definedTargetBackend: TargetBackend?, testKClass: KClass<*>): TargetBackend
|
fun compute(definedTargetBackend: TargetBackend?, testKClass: Class<*>): TargetBackend
|
||||||
}
|
}
|
||||||
|
|
||||||
object DefaultTargetBackendComputer : TargetBackendComputer {
|
object DefaultTargetBackendComputer : TargetBackendComputer {
|
||||||
override fun compute(definedTargetBackend: TargetBackend?, testKClass: KClass<*>): TargetBackend {
|
override fun compute(definedTargetBackend: TargetBackend?, testKClass: Class<*>): TargetBackend {
|
||||||
return definedTargetBackend ?: TargetBackend.ANY
|
return definedTargetBackend ?: TargetBackend.ANY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user