aboutsummaryrefslogtreecommitdiff
path: root/plugins/gfm/src/test/kotlin/renderers
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-07-02 17:32:21 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-07-08 11:48:29 +0200
commit8150d8478018ab36ae2bab0447bbd3322a895e36 (patch)
tree5d8eb1a5c99e3f6a0530c823d5b0453b855efde0 /plugins/gfm/src/test/kotlin/renderers
parentf80d5938ccafcf5bd41d73f98bebe2d9699faa95 (diff)
downloaddokka-8150d8478018ab36ae2bab0447bbd3322a895e36.tar.gz
dokka-8150d8478018ab36ae2bab0447bbd3322a895e36.tar.bz2
dokka-8150d8478018ab36ae2bab0447bbd3322a895e36.zip
Add GFM tests
Diffstat (limited to 'plugins/gfm/src/test/kotlin/renderers')
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt1
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt4
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt1
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt70
-rw-r--r--plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt1
5 files changed, 72 insertions, 5 deletions
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
index 13231c43..64750ec6 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/DivergentTest.kt
@@ -6,7 +6,6 @@ import org.jetbrains.dokka.gfm.CommonmarkRenderer
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.pages.ContentDivergentGroup
import org.junit.jupiter.api.Test
-import renderers.gfm.GfmRenderingOnlyTestBase
import renderers.defaultSourceSet
import renderers.TestPage
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt
index 3636bf26..64e55f4f 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GfmRenderingOnlyTestBase.kt
@@ -11,7 +11,7 @@ import org.jetbrains.dokka.base.resolvers.external.JavadocExternalLocationProvid
import renderers.RenderingOnlyTestBase
import utils.TestOutputWriter
-abstract class GfmRenderingOnlyTestBase : RenderingOnlyTestBase() {
+abstract class GfmRenderingOnlyTestBase : RenderingOnlyTestBase<String>() {
val files = TestOutputWriter()
override val context = MockContext(
@@ -26,7 +26,7 @@ abstract class GfmRenderingOnlyTestBase : RenderingOnlyTestBase() {
)
)
- protected val renderedContent: String by lazy {
+ override val renderedContent: String by lazy {
files.contents.getValue("test-page.md")
}
} \ No newline at end of file
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
index 2e1dc83a..42839282 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/GroupWrappingTest.kt
@@ -1,7 +1,6 @@
package renderers.gfm
import org.jetbrains.dokka.gfm.CommonmarkRenderer
-import renderers.gfm.GfmRenderingOnlyTestBase
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
import renderers.*
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt
new file mode 100644
index 00000000..7464c079
--- /dev/null
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SimpleElementsTest.kt
@@ -0,0 +1,70 @@
+package renderers.gfm
+
+import org.jetbrains.dokka.gfm.CommonmarkRenderer
+import org.junit.jupiter.api.Test
+import renderers.TestPage
+import org.jetbrains.dokka.base.translators.documentables.*
+import org.jetbrains.dokka.pages.TextStyle
+
+class SimpleElementsTest : GfmRenderingOnlyTestBase() {
+
+ @Test
+ fun header() {
+ val page = TestPage {
+ header(1, "The Hobbit or There and Back Again")
+ }
+ val expect = "//[testPage](test-page.md)\n\n\n\n# The Hobbit or There and Back Again \n"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun link() {
+ val page = TestPage {
+ link("They are not all accounted for, the lost Seeing Stones.", "http://www.google.com")
+ }
+ val expect = "//[testPage](test-page.md)\n\n[They are not all accounted for, the lost Seeing Stones.](http://www.google.com)"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun bold() {
+ val page = TestPage {
+ text("That there’s some good in this world, Mr. Frodo… and it’s worth fighting for.", styles = setOf(TextStyle.Bold))
+ }
+ val expect = "//[testPage](test-page.md)\n\n**That there’s some good in this world, Mr. Frodo… and it’s worth fighting for.**"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun italic() {
+ val page = TestPage {
+ text("Even the smallest person can change the course of the future.", styles = setOf(TextStyle.Italic))
+ }
+ val expect = "//[testPage](test-page.md)\n\n*Even the smallest person can change the course of the future.*"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun italicAndBold() {
+ val page = TestPage {
+ text("There is no curse in Elvish, Entish, or the tongues of Men for this treachery.", styles = setOf(TextStyle.Bold, TextStyle.Italic))
+ }
+ val expect = "//[testPage](test-page.md)\n\n***There is no curse in Elvish, Entish, or the tongues of Men for this treachery.***"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+
+ @Test
+ fun strikethrough() {
+ val page = TestPage {
+ text("A day may come when the courage of men fails… but it is not THIS day", styles = setOf(TextStyle.Strikethrough))
+ }
+ val expect = "//[testPage](test-page.md)\n\n~~A day may come when the courage of men fails… but it is not THIS day~~"
+ CommonmarkRenderer(context).render(page)
+ assert(renderedContent == expect)
+ }
+} \ No newline at end of file
diff --git a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
index 64664d4a..18260f0e 100644
--- a/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
+++ b/plugins/gfm/src/test/kotlin/renderers/gfm/SourceSetDependentHintTest.kt
@@ -3,7 +3,6 @@ package renderers.gfm
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.SourceRootImpl
import org.jetbrains.dokka.gfm.CommonmarkRenderer
-import renderers.gfm.GfmRenderingOnlyTestBase
import org.jetbrains.dokka.pages.TextStyle
import org.junit.jupiter.api.Test
import renderers.TestPage