aboutsummaryrefslogtreecommitdiff
path: root/test/src/model/FunctionTest.kt
blob: 90b937dee60bda3f09f3669bb4279308c931be5a (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
package org.jetbrains.dokka.tests

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

public class FunctionTest {
    Test fun function() {
        verifyModel("test/data/functions/function.kt") { model ->
            with(model.nodes.single().members.single()) {
                assertEquals("fn", name)
                assertEquals(DocumentationNodeKind.Function, kind)
                assertEquals("Function fn", doc)
                assertTrue(details.none())
                assertTrue(members.none())
                assertTrue(links.none())
            }
        }
    }

    Test fun functionWithParams() {
        verifyModel("test/data/functions/functionWithParams.kt") { model ->
            with(model.nodes.single().members.single()) {
                assertEquals("function", name)
                assertEquals(DocumentationNodeKind.Function, kind)
                assertEquals("""Multiline
Function
Documentation"""
                             , doc)
                with(details.single()) {
                    assertEquals("x", name)
                    assertEquals(DocumentationNodeKind.Parameter, kind)
                    assertTrue(details.none())
                    assertTrue(members.none())
                    assertTrue(links.none())
                }

                assertTrue(members.none())
                assertTrue(links.none())
            }
        }
    }
}