diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/data/comments/directive.kt | 8 | ||||
-rw-r--r-- | test/data/comments/emptySection.kt | 2 | ||||
-rw-r--r-- | test/data/comments/explicitSummary.kt | 6 | ||||
-rw-r--r-- | test/data/comments/multilineSection.kt | 2 | ||||
-rw-r--r-- | test/data/comments/section1.kt | 2 | ||||
-rw-r--r-- | test/data/comments/section2.kt | 4 | ||||
-rw-r--r-- | test/data/comments/sectionWithBracedLabel.kt | 5 | ||||
-rw-r--r-- | test/data/format/paramTag.kt | 6 | ||||
-rw-r--r-- | test/data/format/paramTag.md | 20 | ||||
-rw-r--r-- | test/data/format/throwsTag.kt | 5 | ||||
-rw-r--r-- | test/data/format/throwsTag.md | 19 | ||||
-rw-r--r-- | test/src/format/MarkdownFormatTest.kt | 12 | ||||
-rw-r--r-- | test/src/model/CommentTest.kt | 55 |
13 files changed, 85 insertions, 61 deletions
diff --git a/test/data/comments/directive.kt b/test/data/comments/directive.kt index 9883b7bd..471ca9bb 100644 --- a/test/data/comments/directive.kt +++ b/test/data/comments/directive.kt @@ -1,10 +1,10 @@ /** * Summary * - * ${code example1} - * ${code example2} - * ${code X.example3} - * ${code X.Y.example4} + * @code example1 + * @code example2 + * @code X.example3 + * @code X.Y.example4 */ val property = "test" diff --git a/test/data/comments/emptySection.kt b/test/data/comments/emptySection.kt index 7112c578..47d6b1a5 100644 --- a/test/data/comments/emptySection.kt +++ b/test/data/comments/emptySection.kt @@ -1,6 +1,6 @@ /** * Summary - * $one: + * @one */ val property = "test"
\ No newline at end of file diff --git a/test/data/comments/explicitSummary.kt b/test/data/comments/explicitSummary.kt deleted file mode 100644 index 68f75c99..00000000 --- a/test/data/comments/explicitSummary.kt +++ /dev/null @@ -1,6 +0,0 @@ - -/** - * $$summary: Summary - * $$description: Description - */ -val property = "test"
\ No newline at end of file diff --git a/test/data/comments/multilineSection.kt b/test/data/comments/multilineSection.kt index 514348cd..6ef4df2c 100644 --- a/test/data/comments/multilineSection.kt +++ b/test/data/comments/multilineSection.kt @@ -1,6 +1,6 @@ /** * Summary - * $one: + * @one * line one * line two */ diff --git a/test/data/comments/section1.kt b/test/data/comments/section1.kt index e4c9adf4..7c763b4c 100644 --- a/test/data/comments/section1.kt +++ b/test/data/comments/section1.kt @@ -1,5 +1,5 @@ /** * Summary - * $one: section one + * @one section one */ val property = "test"
\ No newline at end of file diff --git a/test/data/comments/section2.kt b/test/data/comments/section2.kt index e0a35551..e280793e 100644 --- a/test/data/comments/section2.kt +++ b/test/data/comments/section2.kt @@ -1,6 +1,6 @@ /** * Summary - * $one: section one - * $two: section two + * @one section one + * @two section two */ val property = "test"
\ No newline at end of file diff --git a/test/data/comments/sectionWithBracedLabel.kt b/test/data/comments/sectionWithBracedLabel.kt deleted file mode 100644 index aa8dbfe6..00000000 --- a/test/data/comments/sectionWithBracedLabel.kt +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Summary - * ${this.label.is.really.long}: section one - */ -val property = "test"
\ No newline at end of file diff --git a/test/data/format/paramTag.kt b/test/data/format/paramTag.kt new file mode 100644 index 00000000..47e471f5 --- /dev/null +++ b/test/data/format/paramTag.kt @@ -0,0 +1,6 @@ +/** + * @param x A string + * @param y A number with a really long description that spans multiple lines and goes + * on and on and is very interesting to read + */ +fun f(x: String, y: Int) {} diff --git a/test/data/format/paramTag.md b/test/data/format/paramTag.md new file mode 100644 index 00000000..9534deb3 --- /dev/null +++ b/test/data/format/paramTag.md @@ -0,0 +1,20 @@ +[test](out.md) / [](out.md) / [f](out.md) + + +# f + + +``` +fun f(x: String, y: Int): Unit +``` + + + + + + +### Parameters + +`x` - A string +`y` - A number with a really long description that spans multiple lines and goes +on and on and is very interesting to read diff --git a/test/data/format/throwsTag.kt b/test/data/format/throwsTag.kt new file mode 100644 index 00000000..29a9c3f7 --- /dev/null +++ b/test/data/format/throwsTag.kt @@ -0,0 +1,5 @@ +/** + * @throws IllegalArgumentException on Mondays + * @exception NullPointerException on Tuesdays + */ +fun f() {} diff --git a/test/data/format/throwsTag.md b/test/data/format/throwsTag.md new file mode 100644 index 00000000..d968483b --- /dev/null +++ b/test/data/format/throwsTag.md @@ -0,0 +1,19 @@ +[test](out.md) / [](out.md) / [f](out.md) + + +# f + + +``` +fun f(): Unit +``` + + + + + + +### Exceptions + +`IllegalArgumentException` - on Mondays +`NullPointerException` - on Tuesdays diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt index efde3139..77c03ed2 100644 --- a/test/src/format/MarkdownFormatTest.kt +++ b/test/src/format/MarkdownFormatTest.kt @@ -92,4 +92,16 @@ public class MarkdownFormatTest { markdownService.appendNodes(tempLocation, output, listOf(propertyNode.members[1])) } } + + Test fun paramTag() { + verifyOutput("test/data/format/paramTag.kt", ".md") { model, output -> + markdownService.appendNodes(tempLocation, output, model.members.single().members) + } + } + + Test fun throwsTag() { + verifyOutput("test/data/format/throwsTag.kt", ".md") { model, output -> + markdownService.appendNodes(tempLocation, output, model.members.single().members) + } + } } diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt index 828deaa4..98585b18 100644 --- a/test/src/model/CommentTest.kt +++ b/test/src/model/CommentTest.kt @@ -67,32 +67,22 @@ public class CommentTest { verifyModel("test/data/comments/emptySection.kt") { model -> with(model.members.single().members.single()) { assertEquals("Summary", content.summary.toTestString()) - assertEquals(2, content.sections.count()) - with (content.sections["one"]!!) { - assertEquals("one", label) + assertEquals(1, content.sections.count()) + with (content.findSectionByTag("one")!!) { + assertEquals("One", tag) assertEquals("", toTestString()) } } } } - Test fun explicitSummary() { - verifyModel("test/data/comments/explicitSummary.kt") { model -> - with(model.members.single().members.single()) { - assertEquals("Summary", content.summary.toTestString()) - assertEquals("Description", content.description.toTestString()) - assertEquals(2, content.sections.count()) - } - } - } - Test fun section1() { verifyModel("test/data/comments/section1.kt") { model -> with(model.members.single().members.single()) { assertEquals("Summary", content.summary.toTestString()) - assertEquals(2, content.sections.count()) - with (content.sections["one"]!!) { - assertEquals("one", label) + assertEquals(1, content.sections.count()) + with (content.findSectionByTag("one")!!) { + assertEquals("One", tag) assertEquals("section one", toTestString()) } } @@ -103,13 +93,13 @@ public class CommentTest { verifyModel("test/data/comments/section2.kt") { model -> with(model.members.single().members.single()) { assertEquals("Summary", content.summary.toTestString()) - assertEquals(3, content.sections.count()) - with (content.sections["one"]!!) { - assertEquals("one", label) + assertEquals(2, content.sections.count()) + with (content.findSectionByTag("one")!!) { + assertEquals("One", tag) assertEquals("section one", toTestString()) } - with (content.sections["two"]!!) { - assertEquals("two", label) + with (content.findSectionByTag("two")!!) { + assertEquals("Two", tag) assertEquals("section two", toTestString()) } } @@ -120,9 +110,9 @@ public class CommentTest { verifyModel("test/data/comments/multilineSection.kt") { model -> with(model.members.single().members.single()) { assertEquals("Summary", content.summary.toTestString()) - assertEquals(2, content.sections.count()) - with (content.sections["one"]!!) { - assertEquals("one", label) + assertEquals(1, content.sections.count()) + with (content.findSectionByTag("one")!!) { + assertEquals("One", tag) assertEquals("""line one line two""", toTestString()) } @@ -130,43 +120,26 @@ line two""", toTestString()) } } - Test fun sectionWithBracedLabel() { - verifyModel("test/data/comments/sectionWithBracedLabel.kt") { model -> - with(model.members.single().members.single()) { - assertEquals("Summary", content.summary.toTestString()) - assertEquals(2, content.sections.count()) - with (content.sections["this.label.is.really.long"]!!) { - assertEquals("this.label.is.really.long", label) - assertEquals("section one", toTestString()) - } - } - } - } - Test fun directive() { verifyModel("test/data/comments/directive.kt") { model -> with(model.members.single().members.first()) { assertEquals("Summary", content.summary.toTestString()) - assertEquals(2, content.sections.count()) with (content.description) { assertEqualsIgnoringSeparators("""[code] if (true) { println(property) } [/code] - [code] if (true) { println(property) } [/code] - [code] if (true) { println(property) } [/code] - [code] if (true) { println(property) |