aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/linkResolvers/LinkResolverTest.kt
blob: b2cccce2bba72dfc8039d6f7808760864959bbb2 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package org.jetbrains.dokka.tests.linkResolvers
//
//import junit.framework.Assert.assertEquals
//import org.jetbrains.dokka.testApi.DokkaConfigurationImpl
//import org.jetbrains.dokka.Platform
//import org.jetbrains.dokka.links.DRI
//import org.jetbrains.dokka.pages.*
//import org.jetbrains.dokka.renderers.FileWriter
//import org.jetbrains.dokka.renderers.NewHtmlRenderer
//import org.jetbrains.dokka.resolvers.DefaultLocationProvider
//import org.junit.Test
//
//
//class LinkResolverTest {
//
//    fun createModel(): ModulePageNode {
//        val platform = listOf(PlatformData("jvm", Platform.jvm))
//
//        val moduleSymbol = ContentSymbol(
//            listOf(ContentText("moduleName", platform)),
//            platform)
//
//        val packageDRI = DRI("packageName")
//
//        val module = ModulePageNode("",
//            listOf(moduleSymbol, ContentBlock(
//                "packages",
//                listOf(ContentGroup(listOf(ContentLink("packageName", packageDRI, platform)), platform)),
//                platform)
//            ),
//            null)
//
//        val packageSymbol = ContentSymbol(
//            listOf(ContentText("package moduleName.packageName", platform)),
//            platform)
//
//        val packageNode = PackagePageNode("packageName", listOf(packageSymbol), module, DRI("packageName"))
//
//        val classSymbol = ContentSymbol(
//            listOf(ContentText("class ClassName()", platform)),
//            platform)
//
//        val classNode = ClassPageNode("className", listOf(classSymbol), packageNode, DRI("packageName", "className"))
//
//        val memberSymbol = ContentSymbol(
//            listOf(ContentText("fun funName(): String", platform)),
//            platform)
//
//        val memberText = ContentText("This is some docs for funName", platform)
//
//        val memberNode = MemberPageNode("funName",
//            listOf(memberSymbol, ContentComment(listOf(memberText), platform)),
//            classNode,
//            DRI("packageName", "className", "funName", "..."))
//
//        module.appendChild(packageNode)
//        packageNode.appendChild(classNode)
//        classNode.appendChild(memberNode)
//        return module
//    }
//
//    @Test fun memberLink() {
//        val model = createModel()
//        val linkResolver = DefaultLocationProvider(model, DokkaConfigurationImpl())
//        val link = linkResolver.resolve(model.children.first().children.first().children.first())
//        assertEquals("/--root--/package-name/class-name/fun-name", link)
//    }
//
//    @Test fun classLink() {
//        val model = createModel()
//        val linkResolver = DefaultLocationProvider(model, DokkaConfigurationImpl())
//        val link = linkResolver.resolve(model.children.first().children.first())
//        assertEquals("/--root--/package-name/class-name/index", link)
//    }
//
//    @Test fun moduleLink() {
//        val model = createModel()
//        val linkResolver = DefaultLocationProvider(model, DokkaConfigurationImpl())
//        val link = linkResolver.resolve(model)
//        assertEquals("/--root--/index", link)
//    }
//
//    @Test fun writeToFile() {
//        val model = createModel()
//        val linkResolver = DefaultLocationProvider(model, DokkaConfigurationImpl())
//        val fileWriter = FileWriter("/Users/kamildoleglo/IdeaProjects/dokka/build/dokka", ".html")
//        val renderer = NewHtmlRenderer("/Users/kamildoleglo/IdeaProjects/dokka/build/dokka", fileWriter, linkResolver)
//        renderer.render(model)
//    }
//
//}
//