aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model/ObjectTest.kt
blob: 86045110e0979f3a933cde44d4038ee9104cf4c8 (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
package model

import org.jetbrains.dokka.model.AdditionalModifiers
import org.jetbrains.dokka.model.DObject
import org.jetbrains.dokka.model.ExtraModifiers
import org.junit.jupiter.api.Test
import utils.AbstractModelTest

class ObjectTest : AbstractModelTest("/src/main/kotlin/objects/Test.kt", "objects") {

    @Test
    fun emptyObject() {
        inlineModelTest(
            """
            |object Obj {}
            """.trimIndent()
        ) {
            with((this / "objects" / "Obj").cast<DObject>()) {
                name equals "Obj"
                children counts 3
            }
        }
    }

    @Test
    fun `data object class`() {
        inlineModelTest(
            """
            |data object KotlinDataObject {}
            """.trimIndent()
        ) {
            with((this / "objects" / "KotlinDataObject").cast<DObject>()) {
                name equals "KotlinDataObject"
                extra[AdditionalModifiers]?.content?.values?.single()
                    ?.single() equals ExtraModifiers.KotlinOnlyModifiers.Data
            }
        }
    }
}