aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/model/ObjectTest.kt
blob: 2f307adbdd016a48d9bd6c0d68fbdc9be307d1c8 (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 utils.AbstractModelTest
import kotlin.test.Test

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
            }
        }
    }
}