aboutsummaryrefslogtreecommitdiff
path: root/test/src/ClassTest.kt
blob: be9a29b187ce3d06bd3e2b3c4acd44ee93fec902 (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
package com.jetbrains.dokka.tests

import org.junit.Test
import kotlin.test.*
import com.jetbrains.dokka.*

public class ClassTest {
    Test fun emptyClass() {
        verifyModel("test/data/classes/emptyClass.kt") { model ->
            val item = model.nodes.single().members.single()
            assertEquals(DocumentationNodeKind.Class, item.kind)
            assertEquals("Klass", item.name)
            assertEquals("", item.doc)
            assertTrue(item.details.none())
            assertEquals("<init>", item.members.single().name)
            assertTrue(item.links.none())
        }
    }

    Test fun classWithConstructor() {
        verifyModel("test/data/classes/classWithConstructor.kt") { model ->
            val item = model.nodes.single().members.single()
            assertEquals(DocumentationNodeKind.Class, item.kind)
            assertEquals("Klass", item.name)
            assertEquals("", item.doc)
            assertTrue(item.details.none())
            assertEquals("<init>", item.members.single().name)
            assertTrue(item.links.none())
        }
    }

    Test fun classWithFunction() {
        verifyModel("test/data/classes/classWithFunction.kt") { model ->
            val item = model.nodes.single().members.single()
            assertEquals(DocumentationNodeKind.Class, item.kind)
            assertEquals("Klass", item.name)
            assertEquals("", item.doc)
            assertTrue(item.details.none())
            assertEquals(2, item.members.count())
            assertEquals("<init>", item.members.elementAt(0).name)
            assertEquals("fn", item.members.elementAt(1).name)
            assertTrue(item.links.none())
        }
    }
}