diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/data/format/classWithClassObject.kt | 7 | ||||
-rw-r--r-- | test/data/format/classWithClassObject.md | 53 | ||||
-rw-r--r-- | test/src/TestAPI.kt | 3 | ||||
-rw-r--r-- | test/src/format/MarkdownFormatTest.kt | 6 |
4 files changed, 68 insertions, 1 deletions
diff --git a/test/data/format/classWithClassObject.kt b/test/data/format/classWithClassObject.kt new file mode 100644 index 00000000..459efad6 --- /dev/null +++ b/test/data/format/classWithClassObject.kt @@ -0,0 +1,7 @@ +class Klass() { + class object { + val x = 1 + + fun foo() {} + } +} diff --git a/test/data/format/classWithClassObject.md b/test/data/format/classWithClassObject.md new file mode 100644 index 00000000..10cac365 --- /dev/null +++ b/test/data/format/classWithClassObject.md @@ -0,0 +1,53 @@ +[test](out.md) / [](out.md) / [Klass](out.md) + + +# Klass + + +``` +class Klass +``` + + + + +### Constructors + + +| +[<init>](out.md) + + | +``` +public Klass() +``` + + | + + +### Class Object Properties + + +| +[x](out.md) + + | +``` +val x: Int +``` + + | + + +### Class Object Functions + + +| +[foo](out.md) + + | +``` +fun foo(): Unit +``` + + | diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index a16a0b57..6f4e34c2 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -55,8 +55,9 @@ public fun verifyOutput(path: String, outputGenerator: (DocumentationModule, Str verifyModel(path) { val output = StringBuilder() outputGenerator(it, output) + val trimmedOutput = output.toString().split('\n').map { it.trimTrailing() }.join("\n") val expectedOutput = File(path.replace(".kt", ".md")).readText() - assertEquals(expectedOutput, output.toString()) + assertEquals(expectedOutput.trimTrailing(), trimmedOutput) } } diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt index beb727da..ea501c53 100644 --- a/test/src/format/MarkdownFormatTest.kt +++ b/test/src/format/MarkdownFormatTest.kt @@ -13,4 +13,10 @@ public class MarkdownFormatTest { markdownService.appendNodes(tempLocation, output, model.members.single().members) } } + + Test fun classWithClassObject() { + verifyOutput("test/data/format/classWithClassObject.kt") { model, output -> + markdownService.appendNodes(tempLocation, output, model.members.single().members) + } + } } |