1 package org.jetbrains.dokka.tests 2 3 import org.junit.Test 4 import org.jetbrains.dokka.toTestString 5 import org.jetbrains.dokka.parseMarkdown 6 import org.junit.Ignore 7 8 @Ignore public class ParserTest { runTestFornull9 fun runTestFor(text : String) { 10 println("MD: ---") 11 println(text) 12 val markdownTree = parseMarkdown(text) 13 println("AST: ---") 14 println(markdownTree.toTestString()) 15 println() 16 } 17 textnull18 @Test fun text() { 19 runTestFor("text") 20 } 21 textWithSpacesnull22 @Test fun textWithSpaces() { 23 runTestFor("text and string") 24 } 25 textWithColonnull26 @Test fun textWithColon() { 27 runTestFor("text and string: cool!") 28 } 29 linknull30 @Test fun link() { 31 runTestFor("text [links]") 32 } 33 linkWithHrefnull34 @Test fun linkWithHref() { 35 runTestFor("text [links](http://google.com)") 36 } 37 multilinenull38 @Test fun multiline() { 39 runTestFor( 40 """ 41 text 42 and 43 string 44 """) 45 } 46 paranull47 @Test fun para() { 48 runTestFor( 49 """ 50 paragraph number 51 one 52 53 paragraph 54 number two 55 """) 56 } 57 bulletListnull58 @Test fun bulletList() { 59 runTestFor( 60 """* list item 1 61 * list item 2 62 """) 63 } 64 bulletListWithLinesnull65 @Test fun bulletListWithLines() { 66 runTestFor( 67 """ 68 * list item 1 69 continue 1 70 * list item 2 71 continue 2 72 """) 73 } 74 bulletListStrongnull75 @Test fun bulletListStrong() { 76 runTestFor( 77 """ 78 * list *item* 1 79 continue 1 80 * list *item* 2 81 continue 2 82 """) 83 } 84 emphnull85 @Test fun emph() { 86 runTestFor("*text*") 87 } 88 underscoresNoEmphnull89 @Test fun underscoresNoEmph() { 90 runTestFor("text_with_underscores") 91 } 92 emphUnderscoresnull93 @Test fun emphUnderscores() { 94 runTestFor("_text_") 95 } 96 singleStarnull97 @Test fun singleStar() { 98 runTestFor("Embedded*Star") 99 } 100 directivenull101 @Test fun directive() { 102 runTestFor("A text \${code with.another.value} with directive") 103 } 104 emphAndEmptySectionnull105 @Test fun emphAndEmptySection() { 106 runTestFor("*text*\n\$sec:\n") 107 } 108 emphAndSectionnull109 @Test fun emphAndSection() { 110 runTestFor("*text*\n\$sec: some text\n") 111 } 112 emphAndBracedSectionnull113 @Test fun emphAndBracedSection() { 114 runTestFor("Text *bold* text \n\${sec}: some text") 115 } 116 sectionnull117 @Test fun section() { 118 runTestFor( 119 "Plain text \n\$one: Summary \n\${two}: Description with *emphasis* \n\${An example of a section}: Example") 120 } 121 anonymousSectionnull122 @Test fun anonymousSection() { 123 runTestFor("Summary\n\nDescription\n") 124 } 125 specialSectionnull126 @Test fun specialSection() { 127 runTestFor( 128 "Plain text \n\$\$summary: Summary \n\${\$description}: Description \n\${\$An example of a section}: Example") 129 } 130 emptySectionnull131 @Test fun emptySection() { 132 runTestFor( 133 "Plain text \n\$summary:") 134 } 135 136 val b = "$" pairnull137 @Test fun pair() { 138 runTestFor( 139 """Represents a generic pair of two values. 140 141 There is no meaning attached to values in this class, it can be used for any purpose. 142 Pair exhibits value semantics, i.e. two pairs are equal if both components are equal. 143 144 An example of decomposing it into values: 145 ${b}{code test.tuples.PairTest.pairMultiAssignment} 146 147 ${b}constructor: Creates new instance of [Pair] 148 ${b}first: First value 149 ${b}second: Second value"""" 150 ) 151 } 152 153 } 154 155