aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/transformers/AbstractContextModuleAndPackageDocumentationReaderTest.kt
blob: 8ce9360f9d8048cdf113d896f4a796e1beb47633 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package transformers

import org.jetbrains.dokka.model.SourceSetDependent
import org.jetbrains.dokka.model.doc.DocumentationNode
import org.jetbrains.dokka.model.doc.Text
import org.jetbrains.dokka.model.withDescendants
import org.junit.jupiter.api.io.TempDir
import java.nio.file.Path

abstract class AbstractContextModuleAndPackageDocumentationReaderTest {
    @TempDir
    protected lateinit var temporaryDirectory: Path


    companion object {
        val SourceSetDependent<DocumentationNode>.texts: List<String>
            get() = values.flatMap { it.withDescendants() }
                .flatMap { it.children }
                .flatMap { it.children }
                .mapNotNull { it as? Text }
                .map { it.body }
    }
}