aboutsummaryrefslogtreecommitdiff
path: root/plugins/templating/src/test
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-01-21 00:34:43 +0100
committerGitHub <noreply@github.com>2021-01-21 00:34:43 +0100
commitfdf8a298f586d7e334c312346b70b59c64c8d037 (patch)
treed9e92e920c24f442df6339e19b27225d7d01d21b /plugins/templating/src/test
parent1f592a7ec2786e0a0b77d224d1414ef3042caae4 (diff)
downloaddokka-fdf8a298f586d7e334c312346b70b59c64c8d037.tar.gz
dokka-fdf8a298f586d7e334c312346b70b59c64c8d037.tar.bz2
dokka-fdf8a298f586d7e334c312346b70b59c64c8d037.zip
Empty modules filtering (#1699)
Diffstat (limited to 'plugins/templating/src/test')
-rw-r--r--plugins/templating/src/test/kotlin/templates/AddToNavigationCommandResolutionTest.kt2
-rw-r--r--plugins/templating/src/test/kotlin/templates/AddToSearchCommandResolutionTest.kt2
-rw-r--r--plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt2
-rw-r--r--plugins/templating/src/test/kotlin/templates/TemplatingDokkaTestGenerator.kt6
-rw-r--r--plugins/templating/src/test/kotlin/templates/TestTemplatingGeneration.kt12
5 files changed, 19 insertions, 5 deletions
diff --git a/plugins/templating/src/test/kotlin/templates/AddToNavigationCommandResolutionTest.kt b/plugins/templating/src/test/kotlin/templates/AddToNavigationCommandResolutionTest.kt
index 19c940c2..a1e11dfe 100644
--- a/plugins/templating/src/test/kotlin/templates/AddToNavigationCommandResolutionTest.kt
+++ b/plugins/templating/src/test/kotlin/templates/AddToNavigationCommandResolutionTest.kt
@@ -127,7 +127,7 @@ class AddToNavigationCommandResolutionTest : TemplatingAbstractTest() {
module2Navigation.writeText(inputForModule("module2"))
testFromData(configuration, preserveOutputLocation = true) {
- submoduleProcessingStage = { ctx ->
+ finishProcessingSubmodules = { ctx ->
test(ctx)
}
}
diff --git a/plugins/templating/src/test/kotlin/templates/AddToSearchCommandResolutionTest.kt b/plugins/templating/src/test/kotlin/templates/AddToSearchCommandResolutionTest.kt
index a962d524..049cef96 100644
--- a/plugins/templating/src/test/kotlin/templates/AddToSearchCommandResolutionTest.kt
+++ b/plugins/templating/src/test/kotlin/templates/AddToSearchCommandResolutionTest.kt
@@ -56,7 +56,7 @@ class AddToSearchCommandResolutionTest : TemplatingAbstractTest() {
}
testFromData(configuration, preserveOutputLocation = true) {
- submoduleProcessingStage = { _ ->
+ finishProcessingSubmodules = { _ ->
val expected = elements.map { it.copy(location = "module1/${it.location}") } +
elements.map { it.copy(location = "module2/${it.location}") }
diff --git a/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt b/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt
index d7143f11..9d211876 100644
--- a/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt
+++ b/plugins/templating/src/test/kotlin/templates/SubstitutionCommandResolutionTest.kt
@@ -52,7 +52,7 @@ class SubstitutionCommandResolutionTest : TemplatingAbstractTest() {
}
testFromData(configuration, preserveOutputLocation = true){
- submoduleProcessingStage = {
+ finishProcessingSubmodules = {
assertHtmlEqualsIgnoringWhitespace(expected, testedFile.readText())
}
}
diff --git a/plugins/templating/src/test/kotlin/templates/TemplatingDokkaTestGenerator.kt b/plugins/templating/src/test/kotlin/templates/TemplatingDokkaTestGenerator.kt
index 906fb1ea..04420662 100644
--- a/plugins/templating/src/test/kotlin/templates/TemplatingDokkaTestGenerator.kt
+++ b/plugins/templating/src/test/kotlin/templates/TemplatingDokkaTestGenerator.kt
@@ -36,6 +36,9 @@ class TemplatingDokkaTestGenerator(
generation.processSubmodules()
submoduleProcessingStage(context)
+
+ generation.finishProcessing()
+ finishProcessingSubmodules(context)
}
}
@@ -43,15 +46,18 @@ class TemplatingDokkaTestGenerator(
open class TemplatingTestMethods(
open val pluginsSetupStage: (DokkaContext) -> Unit,
open val submoduleProcessingStage: (DokkaContext) -> Unit,
+ open val finishProcessingSubmodules: (DokkaContext) -> Unit,
) : TestMethods
class TemplatingTestBuilder : TestBuilder<TemplatingTestMethods>() {
var pluginsSetupStage: (DokkaContext) -> Unit = {}
var submoduleProcessingStage: (DokkaContext) -> Unit = {}
+ var finishProcessingSubmodules: (DokkaContext) -> Unit = {}
override fun build() = TemplatingTestMethods(
pluginsSetupStage,
submoduleProcessingStage,
+ finishProcessingSubmodules,
)
}
diff --git a/plugins/templating/src/test/kotlin/templates/TestTemplatingGeneration.kt b/plugins/templating/src/test/kotlin/templates/TestTemplatingGeneration.kt
index 0a5bae4b..5dbe2bbe 100644
--- a/plugins/templating/src/test/kotlin/templates/TestTemplatingGeneration.kt
+++ b/plugins/templating/src/test/kotlin/templates/TestTemplatingGeneration.kt
@@ -4,19 +4,27 @@ import org.jetbrains.dokka.Timer
import org.jetbrains.dokka.generation.Generation
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.plugin
+import org.jetbrains.dokka.plugability.query
import org.jetbrains.dokka.plugability.querySingle
-class TestTemplatingGeneration(context: DokkaContext): Generation {
+class TestTemplatingGeneration(private val context: DokkaContext) : Generation {
val templatingPlugin by lazy { context.plugin<TemplatingPlugin>() }
override fun Timer.generate() {
report("Processing submodules")
processSubmodules()
+
+ report("Finishing processing")
+ finishProcessing()
}
fun processSubmodules() =
- templatingPlugin.querySingle { templateProcessor }.process()
+ templatingPlugin.querySingle { submoduleTemplateProcessor }.process(context.configuration.modules)
+
+ fun finishProcessing() =
+ templatingPlugin.query { templateProcessingStrategy }.forEach { it.finish(context.configuration.outputDir) }
+
override val generationName = "test template generation"
} \ No newline at end of file