• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download

<lambda>null1 package org.jetbrains.dokka.tests
2 
3 import org.jetbrains.dokka.*
4 import org.junit.Before
5 import org.junit.Rule
6 import org.junit.rules.TemporaryFolder
7 
8 
9 abstract class FileGeneratorTestCase {
10     abstract val formatService: FormatService
11 
12     @get:Rule
13     var folder = TemporaryFolder()
14 
15     val fileGenerator = FileGenerator(folder.apply { create() }.root)
16 
17     @Before
18     fun bindGenerator() {
19         fileGenerator.formatService = formatService
20     }
21 
22     fun buildPagesAndReadInto(nodes: List<DocumentationNode>, sb: StringBuilder) = with(fileGenerator) {
23         buildPages(nodes)
24         val byLocations = nodes.groupBy { location(it) }
25         byLocations.forEach { (loc, _) ->
26             if (byLocations.size > 1) {
27                 if (sb.isNotBlank() && !sb.endsWith('\n')) {
28                     sb.appendln()
29                 }
30                 sb.appendln("<!-- File: ${loc.file.relativeTo(root).toUnixString()} -->")
31             }
32             sb.append(loc.file.readText())
33         }
34     }
35 }