From fdf8a298f586d7e334c312346b70b59c64c8d037 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Thu, 21 Jan 2021 00:34:43 +0100 Subject: Empty modules filtering (#1699) --- .../src/test/kotlin/MultiModuleDokkaTestGenerator.kt | 18 +++++++++++++++--- .../templates/ResolveLinkCommandResolutionTest.kt | 4 ++-- .../templates/ResolveLinkGfmCommandResolutionTest.kt | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'plugins/all-modules-page/src/test') diff --git a/plugins/all-modules-page/src/test/kotlin/MultiModuleDokkaTestGenerator.kt b/plugins/all-modules-page/src/test/kotlin/MultiModuleDokkaTestGenerator.kt index c8542dfe..9213c90b 100644 --- a/plugins/all-modules-page/src/test/kotlin/MultiModuleDokkaTestGenerator.kt +++ b/plugins/all-modules-page/src/test/kotlin/MultiModuleDokkaTestGenerator.kt @@ -34,7 +34,10 @@ class MultiModuleDokkaTestGenerator( val generation = context.single(CoreExtensions.generation) as AllModulesPageGeneration - val allModulesPage = generation.createAllModulesPage() + val generationContext = generation.processSubmodules() + submoduleProcessingStage(context) + + val allModulesPage = generation.createAllModulesPage(generationContext) allModulesPageCreationStage(allModulesPage) val transformedPages = generation.transformAllModulesPage(allModulesPage) @@ -43,8 +46,11 @@ class MultiModuleDokkaTestGenerator( generation.render(transformedPages) renderingStage(transformedPages, context) - generation.processSubmodules() - submoduleProcessingStage(context) + generation.processMultiModule(transformedPages) + processMultiModule(transformedPages) + + generation.finishProcessingSubmodules() + finishProcessingSubmodules(context) } } @@ -55,6 +61,8 @@ open class MultiModuleTestMethods( open val pagesTransformationStage: (RootPageNode) -> Unit, open val renderingStage: (RootPageNode, DokkaContext) -> Unit, open val submoduleProcessingStage: (DokkaContext) -> Unit, + open val processMultiModule: (RootPageNode) -> Unit, + open val finishProcessingSubmodules: (DokkaContext) -> Unit, ) : TestMethods class MultiModuleTestBuilder : TestBuilder() { @@ -63,6 +71,8 @@ class MultiModuleTestBuilder : TestBuilder() { var pagesTransformationStage: (RootPageNode) -> Unit = {} var renderingStage: (RootPageNode, DokkaContext) -> Unit = { _, _ -> } var submoduleProcessingStage: (DokkaContext) -> Unit = {} + var processMultiModule: (RootPageNode) -> Unit = {} + var finishProcessingSubmodules: (DokkaContext) -> Unit = {} override fun build() = MultiModuleTestMethods( pluginsSetupStage, @@ -70,6 +80,8 @@ class MultiModuleTestBuilder : TestBuilder() { pagesTransformationStage, renderingStage, submoduleProcessingStage, + processMultiModule, + finishProcessingSubmodules ) } diff --git a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt index cbf254a0..2637714f 100644 --- a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt +++ b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkCommandResolutionTest.kt @@ -60,7 +60,7 @@ class ResolveLinkCommandResolutionTest : MultiModuleAbstractTest() { val configuration = configuration() testFromData(configuration, preserveOutputLocation = true) { - submoduleProcessingStage = { + finishProcessingSubmodules = { assertHtmlEqualsIgnoringWhitespace(expected, contentFile.readText()) } } @@ -89,7 +89,7 @@ class ResolveLinkCommandResolutionTest : MultiModuleAbstractTest() { val configuration = configuration() testFromData(configuration, preserveOutputLocation = true) { - submoduleProcessingStage = { + finishProcessingSubmodules = { assertHtmlEqualsIgnoringWhitespace(expected, contentFile.readText()) } } diff --git a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt index 75576727..185a179d 100644 --- a/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt +++ b/plugins/all-modules-page/src/test/kotlin/templates/ResolveLinkGfmCommandResolutionTest.kt @@ -55,7 +55,7 @@ class ResolveLinkGfmCommandResolutionTest : MultiModuleAbstractTest() { val configuration = configuration() testFromData(configuration, pluginOverrides = listOf(GfmTemplateProcessingPlugin(), GfmPlugin()), preserveOutputLocation = true) { - submoduleProcessingStage = { + finishProcessingSubmodules = { assertEquals(expected, content.readText().trim()) } } -- cgit