| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.rendering.wikimodel.test; |
| 21 |
|
|
| 22 |
|
import org.xwiki.rendering.wikimodel.IWikiParser; |
| 23 |
|
import org.xwiki.rendering.wikimodel.WikiParserException; |
| 24 |
|
import org.xwiki.rendering.wikimodel.jspwiki.JspWikiParser; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
@version |
| 28 |
|
@since |
| 29 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (73) |
Complexity: 14 |
Complexity Density: 0.24 |
|
| 30 |
|
public class JspWikiParserTest extends AbstractWikiParserTest |
| 31 |
|
{ |
| 32 |
|
|
| 33 |
|
@param |
| 34 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 35 |
12 |
public JspWikiParserTest(String name)... |
| 36 |
|
{ |
| 37 |
12 |
super(name); |
| 38 |
|
} |
| 39 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 40 |
57 |
@Override... |
| 41 |
|
protected IWikiParser newWikiParser() |
| 42 |
|
{ |
| 43 |
57 |
return new JspWikiParser(); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@throws |
| 48 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 49 |
1 |
public void testEscape() throws WikiParserException... |
| 50 |
|
{ |
| 51 |
1 |
test("[a reference]"); |
| 52 |
1 |
test("[[not a reference]"); |
| 53 |
|
|
| 54 |
1 |
test("~First letter is escaped"); |
| 55 |
1 |
test("~[not a reference]"); |
| 56 |
1 |
test("~~escaped tilda"); |
| 57 |
1 |
test("~ just a tilda because there is an espace after this tilda..."); |
| 58 |
|
|
| 59 |
1 |
test("!Heading\n~!Not a heading\n!Heading again!"); |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
|
| 63 |
|
@throws |
| 64 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 65 |
1 |
public void testFormats() throws WikiParserException... |
| 66 |
|
{ |
| 67 |
1 |
test("__bold__"); |
| 68 |
1 |
test("''italic''"); |
| 69 |
1 |
test("__bold"); |
| 70 |
1 |
test("''italic"); |
| 71 |
|
|
| 72 |
1 |
test("not a bold__"); |
| 73 |
1 |
test("not an italic''"); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
@throws |
| 78 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 79 |
1 |
public void testHeaders() throws WikiParserException... |
| 80 |
|
{ |
| 81 |
1 |
test("!!!Header"); |
| 82 |
1 |
test("\n!!!Header\n* list item"); |
| 83 |
1 |
test("before\n! Header\nafter"); |
| 84 |
1 |
test("before\n!! Header \nafter"); |
| 85 |
1 |
test("This is not a header: !!"); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
@throws |
| 90 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 91 |
1 |
public void testHorLine() throws WikiParserException... |
| 92 |
|
{ |
| 93 |
1 |
test("----"); |
| 94 |
1 |
test("-------"); |
| 95 |
1 |
test("-----------"); |
| 96 |
1 |
test(" -----------"); |
| 97 |
1 |
test("---abc"); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
@throws |
| 102 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 103 |
1 |
public void testLineBreak() throws WikiParserException... |
| 104 |
|
{ |
| 105 |
1 |
test("abc\\\\def"); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
|
| 109 |
|
@throws |
| 110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 111 |
1 |
public void testLists() throws WikiParserException... |
| 112 |
|
{ |
| 113 |
1 |
test("*first"); |
| 114 |
1 |
test("* first"); |
| 115 |
1 |
test("** second"); |
| 116 |
1 |
test("*item one\n" |
| 117 |
|
+ "* item two\n" |
| 118 |
|
+ "*#item three\n" |
| 119 |
|
+ "*# item four\n" |
| 120 |
|
+ "* item five - first line\n" |
| 121 |
|
+ " item five - second line\n" |
| 122 |
|
+ "* item six\n" |
| 123 |
|
+ " is on multiple\n" |
| 124 |
|
+ " lines"); |
| 125 |
|
|
| 126 |
1 |
test(";term: definition"); |
| 127 |
1 |
test(";:just definition"); |
| 128 |
1 |
test(";just term"); |
| 129 |
1 |
test(";:"); |
| 130 |
|
|
| 131 |
1 |
test(";term one: definition one\n" |
| 132 |
|
+ ";term two: definition two\n" |
| 133 |
|
+ ";term three: definition three"); |
| 134 |
|
|
| 135 |
1 |
test(";One,\ntwo,\nbucle my shoes...:\n" |
| 136 |
|
+ "...Three\nfour,\nClose the door\n" |
| 137 |
|
+ ";Five,\nSix: Pick up\n sticks\n\ntam-tam, pam-pam..."); |
| 138 |
|
|
| 139 |
1 |
test(";__term__: ''definition''"); |
| 140 |
|
|
| 141 |
1 |
test("this is not a definition --\n" |
| 142 |
|
+ " ;__not__ a term: ''not'' a definition\n" |
| 143 |
|
+ "----toto"); |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
|
| 147 |
|
@throws |
| 148 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
| 149 |
1 |
public void testParagraphs() throws WikiParserException... |
| 150 |
|
{ |
| 151 |
1 |
test("First paragraph.\n" |
| 152 |
|
+ "Second line of the same paragraph.\n" |
| 153 |
|
+ "\n" |
| 154 |
|
+ "The second paragraph"); |
| 155 |
|
|
| 156 |
1 |
test("\n<toto"); |
| 157 |
|
} |
| 158 |
|
|
| 159 |
|
|
| 160 |
|
@throws |
| 161 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 162 |
1 |
public void testQuot() throws WikiParserException... |
| 163 |
|
{ |
| 164 |
1 |
test("This is a paragraph\n\n and this is a quotations\n the second line"); |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
|
| 168 |
|
@throws |
| 169 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 170 |
1 |
public void testReferences() throws WikiParserException... |
| 171 |
|
{ |
| 172 |
1 |
test("before http://www.foo.bar/com after"); |
| 173 |
1 |
test("before [toto] after"); |
| 174 |
1 |
test("before wiki:Hello after"); |
| 175 |
1 |
test("before wiki~:Hello after"); |
| 176 |
1 |
test("before [#local ancor] after"); |
| 177 |
|
|
| 178 |
1 |
test("not [[a reference] at all!"); |
| 179 |
|
} |
| 180 |
|
|
| 181 |
|
|
| 182 |
|
@throws |
| 183 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 184 |
1 |
public void testSpecialSymbols() throws WikiParserException... |
| 185 |
|
{ |
| 186 |
1 |
test(":)"); |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
|
| 190 |
|
@throws |
| 191 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 192 |
1 |
public void testTables() throws WikiParserException... |
| 193 |
|
{ |
| 194 |
1 |
test("|| cell 1.1 || cell 1.2\n" + "|| cell 2.1|| cell 2.2"); |
| 195 |
1 |
test("|| Head 1.1 || Head 1.2\n" + "| cell 2.1| cell 2.2"); |
| 196 |
1 |
test("|| Multi \nline \nheader \n" |
| 197 |
|
+ "| Multi\nline\ncell\n\nOne,two,three..."); |
| 198 |
1 |
test("this is not || a table"); |
| 199 |
1 |
test("this is not | a table"); |
| 200 |
1 |
test("|| ''Italic header'' || __Bold header__\n" |
| 201 |
|
+ "| ''Italic cell'' | __Bold cell__\n"); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
|
| 205 |
|
@throws |
| 206 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 207 |
1 |
public void testVerbatimeBlocks() throws WikiParserException... |
| 208 |
|
{ |
| 209 |
1 |
test("abc \n{{{ 123\n CDE\n 345 }}} efg"); |
| 210 |
1 |
test("abc {{{ 123\n CDE\n 345 }}} efg"); |
| 211 |
1 |
test("abc\n{{{\n {{{ 123 \n}\\}} \n}}} efg"); |
| 212 |
1 |
test("inline{{verbatime}}block"); |
| 213 |
1 |
test("{{just like this..."); |
| 214 |
|
} |
| 215 |
|
} |