diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-09-29 20:54:59 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-09-29 20:54:59 +0400 |
commit | 778e2b3f7ff62971e18a49d81a8825e5dd894c2e (patch) | |
tree | f7fb9506800262ecabb9050ffee4a97e39812ccb /test/src/model/CommentTest.kt | |
parent | 2e3dc238275073a5c7a2e5a14c79337d12492dad (diff) | |
download | dokka-778e2b3f7ff62971e18a49d81a8825e5dd894c2e.tar.gz dokka-778e2b3f7ff62971e18a49d81a8825e5dd894c2e.tar.bz2 dokka-778e2b3f7ff62971e18a49d81a8825e5dd894c2e.zip |
Extract content model, make doc model independent from descriptors, parse doccomments with custom parser, some tests failing due to hanging new lines.
Diffstat (limited to 'test/src/model/CommentTest.kt')
-rw-r--r-- | test/src/model/CommentTest.kt | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt index 28f717db..62f64a58 100644 --- a/test/src/model/CommentTest.kt +++ b/test/src/model/CommentTest.kt @@ -8,7 +8,7 @@ public class CommentTest { Test fun emptyDoc() { verifyModel("test/data/comments/emptyDoc.kt") { model -> with(model.members.single().members.single()) { - assertEquals(DocumentationContent.Empty, doc) + assertEquals(Content.Empty, doc) } } } @@ -16,7 +16,7 @@ public class CommentTest { Test fun emptyDocButComment() { verifyModel("test/data/comments/emptyDocButComment.kt") { model -> with(model.members.single().members.single()) { - assertEquals(DocumentationContent.Empty, doc) + assertEquals(Content.Empty, doc) } } } @@ -24,8 +24,8 @@ public class CommentTest { Test fun multilineDoc() { verifyModel("test/data/comments/multilineDoc.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc1".toRichString(), doc.summary) - assertEquals("doc2\ndoc3".toRichString(), doc.description) + assertEquals("doc1", doc.summary.toTestString()) + assertEquals("doc2\ndoc3\n", doc.description.toTestString()) } } } @@ -33,8 +33,8 @@ public class CommentTest { Test fun multipleDocs() { verifyModel("test/data/comments/multipleDocs.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc1".toRichString(), doc.summary) - assertEquals("doc2\ndoc3".toRichString(), doc.description) + assertEquals("doc1", doc.summary.toTestString()) + assertEquals("doc2\ndoc3", doc.description.toTestString()) } } } @@ -42,8 +42,8 @@ public class CommentTest { Test fun multilineDocWithComment() { verifyModel("test/data/comments/multilineDocWithComment.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc1".toRichString(), doc.summary) - assertEquals("doc2\ndoc3".toRichString(), doc.description) + assertEquals("doc1", doc.summary.toTestString()) + assertEquals("doc2\ndoc3", doc.description.toTestString()) } } } @@ -51,7 +51,7 @@ public class CommentTest { Test fun oneLineDoc() { verifyModel("test/data/comments/oneLineDoc.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc".toRichString(), doc.summary) + assertEquals("doc", doc.summary.toTestString()) } } } @@ -59,7 +59,7 @@ public class CommentTest { Test fun oneLineDocWithComment() { verifyModel("test/data/comments/oneLineDocWithComment.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc".toRichString(), doc.summary) + assertEquals("doc", doc.summary.toTestString()) } } } @@ -67,7 +67,7 @@ public class CommentTest { Test fun oneLineDocWithEmptyLine() { verifyModel("test/data/comments/oneLineDocWithEmptyLine.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc".toRichString(), doc.summary) + assertEquals("doc", doc.summary.toTestString()) } } } @@ -76,24 +76,34 @@ public class CommentTest { verifyModel("test/data/comments/emptySection.kt") { model -> with(model.members.single().members.single()) { assertEquals(NormalStyle, NormalStyle) - assertEquals("Summary".toRichString(), doc.summary) + assertEquals("Summary", doc.summary.toTestString()) assertEquals(2, doc.sections.count()) with (doc.sections["one"]!!) { assertEquals("one", label) - assertEquals(RichString.empty, text) + assertEquals("", toTestString()) } } } } + Test fun explicitSummary() { + verifyModel("test/data/comments/explicitSummary.kt") { model -> + with(model.members.single().members.single()) { + assertEquals("Summary", doc.summary.toTestString()) + assertEquals("Description", doc.description.toTestString()) + assertEquals(2, doc.sections.count()) + } + } + } + Test fun section1() { verifyModel("test/data/comments/section1.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary".toRichString(), doc.summary) + assertEquals("Summary", doc.summary.toTestString()) assertEquals(2, doc.sections.count()) with (doc.sections["one"]!!) { assertEquals("one", label) - assertEquals("section one".toRichString(), text) + assertEquals("section one", toTestString()) } } } @@ -102,15 +112,15 @@ public class CommentTest { Test fun section2() { verifyModel("test/data/comments/section2.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary".toRichString(), doc.summary) + assertEquals("Summary", doc.summary.toTestString()) assertEquals(3, doc.sections.count()) with (doc.sections["one"]!!) { assertEquals("one", label) - assertEquals("section one".toRichString(), text) + assertEquals("section one", toTestString()) } with (doc.sections["two"]!!) { assertEquals("two", label) - assertEquals("section two".toRichString(), text) + assertEquals("section two", toTestString()) } } } @@ -119,11 +129,11 @@ public class CommentTest { Test fun sectionOnOneLine() { verifyModel("test/data/comments/sectionOnOneLine.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary".toRichString(), doc.summary) + assertEquals("Summary", doc.summary.toTestString()) assertEquals(2, doc.sections.count()) with (doc.sections["one"]!!) { assertEquals("one", label) - assertEquals("same line".toRichString(), text) + assertEquals("same line", toTestString()) } } } @@ -132,11 +142,11 @@ public class CommentTest { Test fun emptySectionOnOneLine() { verifyModel("test/data/comments/emptySectionOnOneLine.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary".toRichString(), doc.summary) + assertEquals("Summary", doc.summary.toTestString()) assertEquals(2, doc.sections.count()) with (doc.sections["one"]!!) { assertEquals("one", label) - assertEquals(RichString.empty, text) + assertEquals("", toTestString()) } } } @@ -145,12 +155,12 @@ public class CommentTest { Test fun multilineSection() { verifyModel("test/data/comments/multilineSection.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary".toRichString(), doc.summary) + assertEquals("Summary", doc.summary.toTestString()) assertEquals(2, doc.sections.count()) with (doc.sections["one"]!!) { assertEquals("one", label) assertEquals("""line one -line two""".toRichString(), text) +line two""", toTestString()) } } } @@ -159,11 +169,11 @@ line two""".toRichString(), text) Test fun sectionWithBracedLabel() { verifyModel("test/data/comments/sectionWithBracedLabel.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary".toRichString(), doc.summary) + assertEquals("Summary", doc.summary.toTestString()) assertEquals(2, doc.sections.count()) with (doc.sections["this.label.is.really.long"]!!) { assertEquals("this.label.is.really.long", label) - assertEquals("section one".toRichString(), text) + assertEquals("section one", toTestString()) } } } |