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

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


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

    Test fun functionWithParams() {
        verifyFiles("test/data/functions/functionWithParams.kt") { model ->
            val item = model.nodes.single().members.single()
            assertEquals(DocumentationNodeKind.Function, item.kind)
            assertEquals("function", item.name)
            assertEquals("""Multiline
Function
Documentation"""
            , item.doc)
            assertEquals("x", item.details.single().name)
            assertEquals(DocumentationNodeKind.Parameter, item.details.single().kind)

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