aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/model/ContentSourceSetTest.kt
blob: cb17bcba14208e13a567c9a9af202bbecff1d1ce (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package model

import org.jetbrains.dokka.DokkaSourceSetID
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.pages.CompositeSourceSetID
import org.jetbrains.dokka.pages.ContentSourceSet
import org.jetbrains.dokka.pages.sourceSetIDs
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class ContentSourceSetTest {
    @Test
    fun `contains sourceSetId`() {
        val contentSourceSet = ContentSourceSet(
            sourceSetIDs = CompositeSourceSetID(listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2"))),
            displayName = "displayName",
            analysisPlatform = Platform.common
        )

        assertFalse(
            DokkaSourceSetID("m3", "s3") in contentSourceSet,
            "Expected source set id not being contained in content source set"
        )

        assertTrue(
            DokkaSourceSetID("m1", "s1") in contentSourceSet,
            "Expected source set id being contained in content source set"
        )

        assertTrue(
            DokkaSourceSetID("m1+m2", "s1+s2") in contentSourceSet,
            "Expected merged source set being contained in content source set"
        )
    }

    @Test
    fun `Iterable contains sourceSetId`() {

        val contentSourceSet = ContentSourceSet(
            sourceSetIDs = CompositeSourceSetID(listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2"))),
            displayName = "displayName",
            analysisPlatform = Platform.common
        )

        assertFalse(
            DokkaSourceSetID("m3", "s3") in listOf(contentSourceSet).sourceSetIDs,
            "Expected source set id not being contained in content source set"
        )

        assertTrue(
            DokkaSourceSetID("m1", "s1") in listOf(contentSourceSet).sourceSetIDs,
            "Expected source set id being contained in content source set"
        )

        assertTrue(
            DokkaSourceSetID("m1+m2", "s1+s2") in listOf(contentSourceSet).sourceSetIDs,
            "Expected merged source set being contained in content source set"
        )
    }
}