diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/data/format/functionWithDefaultParameter.kt | 1 | ||||
-rw-r--r-- | test/data/format/functionWithDefaultParameter.md | 12 | ||||
-rw-r--r-- | test/data/format/propertyVar.kt | 1 | ||||
-rw-r--r-- | test/data/format/propertyVar.md | 12 | ||||
-rw-r--r-- | test/data/functions/functionWithDefaultParameter.kt | 1 | ||||
-rw-r--r-- | test/src/TestAPI.kt | 2 | ||||
-rw-r--r-- | test/src/format/MarkdownFormatTest.kt | 12 | ||||
-rw-r--r-- | test/src/model/FunctionTest.kt | 14 | ||||
-rw-r--r-- | test/src/model/PropertyTest.kt | 3 |
9 files changed, 56 insertions, 2 deletions
diff --git a/test/data/format/functionWithDefaultParameter.kt b/test/data/format/functionWithDefaultParameter.kt new file mode 100644 index 00000000..3a3a102f --- /dev/null +++ b/test/data/format/functionWithDefaultParameter.kt @@ -0,0 +1 @@ +fun f(x: String = "") {} diff --git a/test/data/format/functionWithDefaultParameter.md b/test/data/format/functionWithDefaultParameter.md new file mode 100644 index 00000000..1acab0ef --- /dev/null +++ b/test/data/format/functionWithDefaultParameter.md @@ -0,0 +1,12 @@ +[test](out.md) / [](out.md) / [f](out.md) + + +# f + + +``` +fun f(x: String = ""): Unit +``` + + + diff --git a/test/data/format/propertyVar.kt b/test/data/format/propertyVar.kt new file mode 100644 index 00000000..88be1a7a --- /dev/null +++ b/test/data/format/propertyVar.kt @@ -0,0 +1 @@ +var x = 1
\ No newline at end of file diff --git a/test/data/format/propertyVar.md b/test/data/format/propertyVar.md new file mode 100644 index 00000000..6b14fca3 --- /dev/null +++ b/test/data/format/propertyVar.md @@ -0,0 +1,12 @@ +[test](out.md) / [](out.md) / [x](out.md) + + +# x + + +``` +var x: Int +``` + + + diff --git a/test/data/functions/functionWithDefaultParameter.kt b/test/data/functions/functionWithDefaultParameter.kt new file mode 100644 index 00000000..3a3a102f --- /dev/null +++ b/test/data/functions/functionWithDefaultParameter.kt @@ -0,0 +1 @@ +fun f(x: String = "") {} diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index 4d64014e..f3c5f8c8 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -32,7 +32,7 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> addSources(files.toList()) } - val options = DocumentationOptions(includeNonPublic = true) + val options = DocumentationOptions(includeNonPublic = true, sourceLinks = listOf<SourceLinkDefinition>()) val documentation = environment.withContext { environment, session -> val fragments = environment.getSourceFiles().map { session.getPackageFragment(it.getPackageFqName()) }.filterNotNull().distinct() diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt index 180aceae..efde3139 100644 --- a/test/src/format/MarkdownFormatTest.kt +++ b/test/src/format/MarkdownFormatTest.kt @@ -70,6 +70,18 @@ public class MarkdownFormatTest { } + Test fun propertyVar() { + verifyOutput("test/data/format/propertyVar.kt", ".md") { model, output -> + markdownService.appendNodes(tempLocation, output, model.members.single().members) + } + } + + Test fun functionWithDefaultParameter() { + verifyOutput("test/data/format/functionWithDefaultParameter.kt", ".md") { model, output -> + markdownService.appendNodes(tempLocation, output, model.members.single().members) + } + } + Test fun accessor() { verifyOutput("test/data/format/accessor.kt", ".get.md") { model, output -> val propertyNode = model.members.single().members.first { it.name == "C" }.members.first { it.name == "x" } diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt index 299f33a8..c648cb55 100644 --- a/test/src/model/FunctionTest.kt +++ b/test/src/model/FunctionTest.kt @@ -194,4 +194,18 @@ Documentation""", content.description.toTestString()) } } } + + Test fun functionWithDefaultParameter() { + verifyModel("test/data/functions/functionWithDefaultParameter.kt") { model -> + with(model.members.single().members.single()) { + with(details.elementAt(2)) { + val value = details(DocumentationNode.Kind.Value) + assertEquals(1, value.count()) + with(value[0]) { + assertEquals("\"\"", name) + } + } + } + } + } } diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt index 14c43f78..d6de84bb 100644 --- a/test/src/model/PropertyTest.kt +++ b/test/src/model/PropertyTest.kt @@ -57,11 +57,12 @@ public class PropertyTest { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) assertEquals(Content.Empty, content) - assertEquals(3, details.count()) + assertEquals(4, details.count()) assertEquals("String", detail(DocumentationNode.Kind.Type).name) val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name } assertTrue("final" in modifiers) assertTrue("internal" in modifiers) + assertTrue("var" in modifiers) assertTrue(links.none()) assertEquals(2, members.count()) |