aboutsummaryrefslogtreecommitdiff
path: root/test/src/markdown
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-09-26 21:04:33 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-09-26 21:04:33 +0400
commit2e3dc238275073a5c7a2e5a14c79337d12492dad (patch)
tree53f54e03f0564500e72f7dede11baf7ae6871bb1 /test/src/markdown
parent7b2e274afa45560796160308ba286651651d7099 (diff)
downloaddokka-2e3dc238275073a5c7a2e5a14c79337d12492dad.tar.gz
dokka-2e3dc238275073a5c7a2e5a14c79337d12492dad.tar.bz2
dokka-2e3dc238275073a5c7a2e5a14c79337d12492dad.zip
Continue markdown processing
Diffstat (limited to 'test/src/markdown')
-rw-r--r--test/src/markdown/MarkdownTestRunner.kt5
-rw-r--r--test/src/markdown/ParserTest.kt53
2 files changed, 30 insertions, 28 deletions
diff --git a/test/src/markdown/MarkdownTestRunner.kt b/test/src/markdown/MarkdownTestRunner.kt
index bf1d9516..4ba9675e 100644
--- a/test/src/markdown/MarkdownTestRunner.kt
+++ b/test/src/markdown/MarkdownTestRunner.kt
@@ -84,7 +84,10 @@ public class MarkdownTestRunner(specificationClass: Class<MarkdownSpecification>
private fun createTests(parent: MarkdownTestSection, lines: List<String>): Int {
val testMark = lines.takeWhile { it.trim() != "." }
val testHtml = lines.drop(testMark.size).drop(1).takeWhile { it.trim() != "." }
- parent.children.add(MarkdownTestCase(spec, testMark.join("\n", postfix = "\n"), testHtml.join("\n", postfix = "\n")))
+ val markdown = testMark.join("\n", postfix = "\n", prefix = "\n")
+ val html = testHtml.join("\n", postfix = "\n")
+ val markdownTestCase = MarkdownTestCase(spec, markdown, html)
+ parent.children.add(markdownTestCase)
return testMark.size + testHtml.size + 3
}
diff --git a/test/src/markdown/ParserTest.kt b/test/src/markdown/ParserTest.kt
index 7b1522bc..726505cf 100644
--- a/test/src/markdown/ParserTest.kt
+++ b/test/src/markdown/ParserTest.kt
@@ -1,84 +1,83 @@
package org.jetbrains.dokka.tests
import org.junit.Test
-import org.jetbrains.dokka.*
+import org.jetbrains.dokka
+import org.jetbrains.dokka.MarkdownProcessor
+import org.jetbrains.dokka.dump
+import org.jetbrains.dokka.toHtml
public class ParserTest {
+ fun runTestFor(text : String) {
+ val markdownTree = MarkdownProcessor().parse(text)
+ println(markdownTree.dump())
+ println(markdownTree.toHtml())
+ }
+
Test fun text() {
- val markdown = MarkdownProcessor().parse("text")
- println(markdown.dump())
+ runTestFor("text")
}
Test fun textWithSpaces() {
- val markdown = MarkdownProcessor().parse("text and string")
- println(markdown.dump())
+ runTestFor("text and string")
}
Test fun link() {
- val markdown = MarkdownProcessor().parse("text [links]")
- println(markdown.dump())
+ runTestFor("text [links]")
}
Test fun linkWithHref() {
- val markdown = MarkdownProcessor().parse("text [links](http://destination)")
- println(markdown.dump())
+ runTestFor("text [links](http://destination)")
}
Test fun multiline() {
- val markdown = MarkdownProcessor().parse(
-"""
+ runTestFor(
+ """
text
and
string
""")
- println(markdown.dump())
}
Test fun para() {
- val markdown = MarkdownProcessor().parse(
-"""paragraph number
+ runTestFor(
+ """
+paragraph number
one
paragraph
number two
""")
- println(markdown.dump())
}
Test fun bulletList() {
- val markdown = MarkdownProcessor().parse(
-"""
-* list item 1
+ runTestFor(
+ """* list item 1
* list item 2
""")
- println(markdown.dump())
}
Test fun bulletListWithLines() {
- val markdown = MarkdownProcessor().parse(
-"""
+ runTestFor(
+ """
* list item 1
continue 1
* list item 2
continue 2
""")
- println(markdown.dump())
}
Test fun bulletListStrong() {
- val markdown = MarkdownProcessor().parse(
-"""
+ runTestFor(
+ """
* list *item* 1
continue 1
* list *item* 2
continue 2
""")
- println(markdown.dump())
}
Test fun emph() {
- val markdown = MarkdownProcessor().parse("*text*")
- println(markdown.dump())
+ runTestFor("*text*")
}
}