| 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.common.CommonWikiParser; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
@version |
| 28 |
|
@since |
| 29 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (285) |
Complexity: 24 |
Complexity Density: 0.09 |
|
| 30 |
|
public class CommonWikiParserTest extends AbstractWikiParserTest |
| 31 |
|
{ |
| 32 |
|
|
| 33 |
|
@param |
| 34 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 35 |
22 |
public CommonWikiParserTest(String name)... |
| 36 |
|
{ |
| 37 |
22 |
super(name, true, true); |
| 38 |
|
} |
| 39 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 40 |
257 |
@Override... |
| 41 |
|
protected IWikiParser newWikiParser() |
| 42 |
|
{ |
| 43 |
257 |
return new CommonWikiParser(); |
| 44 |
|
} |
| 45 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
| 46 |
1 |
public void test() throws Exception... |
| 47 |
|
{ |
| 48 |
1 |
showSections(true); |
| 49 |
1 |
test("((()))", "" |
| 50 |
|
+ "<section-1-0>\n" |
| 51 |
|
+ "<sectionContent-1-0>\n" |
| 52 |
|
+ "<div class='wikimodel-document'>\n" |
| 53 |
|
+ "<section-2-0>\n" |
| 54 |
|
+ "<sectionContent-2-0>\n" |
| 55 |
|
+ "</sectionContent-2-0>\n" |
| 56 |
|
+ "</section-2-0>\n" |
| 57 |
|
+ "</div>\n" |
| 58 |
|
+ "</sectionContent-1-0>\n" |
| 59 |
|
+ "</section-1-0>"); |
| 60 |
1 |
test("=Header1=\nabc((()))\ncde", "" |
| 61 |
|
+ "<section-1-0>\n" |
| 62 |
|
+ "<sectionContent-1-0>\n" |
| 63 |
|
+ "<section-1-1>\n" |
| 64 |
|
+ "<h1>Header1</h1>\n" |
| 65 |
|
+ "<sectionContent-1-1>\n" |
| 66 |
|
+ "<p>abc</p>\n" |
| 67 |
|
+ "<div class='wikimodel-document'>\n" |
| 68 |
|
+ "<section-2-0>\n" |
| 69 |
|
+ "<sectionContent-2-0>\n" |
| 70 |
|
+ "</sectionContent-2-0>\n" |
| 71 |
|
+ "</section-2-0>\n" |
| 72 |
|
+ "</div>\n" |
| 73 |
|
+ "<p>cde</p>\n" |
| 74 |
|
+ "</sectionContent-1-1>\n" |
| 75 |
|
+ "</section-1-1>\n" |
| 76 |
|
+ "</sectionContent-1-0>\n" |
| 77 |
|
+ "</section-1-0>"); |
| 78 |
|
} |
| 79 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
| 80 |
1 |
public void testComplexFormatting() throws WikiParserException... |
| 81 |
|
{ |
| 82 |
1 |
test("%rdf:type toto:Document\n" |
| 83 |
|
+ "\n" |
| 84 |
|
+ "%title Hello World\n" |
| 85 |
|
+ "\n" |
| 86 |
|
+ "%summary This is a short description\n" |
| 87 |
|
+ "%locatedIn (((\n" |
| 88 |
|
+ " %type [City]\n" |
| 89 |
|
+ " %name [Paris]\n" |
| 90 |
|
+ " %address (((\n" |
| 91 |
|
+ " %building 10\n" |
| 92 |
|
+ " %street Cité Nollez\n" |
| 93 |
|
+ " ))) \n" |
| 94 |
|
+ ")))\n" |
| 95 |
|
+ "= Hello World =\n" |
| 96 |
|
+ "\n" |
| 97 |
|
+ "* item one\n" |
| 98 |
|
+ " * sub-item a\n" |
| 99 |
|
+ " * sub-item b\n" |
| 100 |
|
+ " + ordered X \n" |
| 101 |
|
+ " + ordered Y\n" |
| 102 |
|
+ " * sub-item c\n" |
| 103 |
|
+ "* item two\n" |
| 104 |
|
+ "\n" |
| 105 |
|
+ "\n" |
| 106 |
|
+ "The table below contains \n" |
| 107 |
|
+ "an %seeAlso(embedded document). \n" |
| 108 |
|
+ "It can contain the same formatting \n" |
| 109 |
|
+ "elements as the root document.\n" |
| 110 |
|
+ "\n" |
| 111 |
|
+ "\n" |
| 112 |
|
+ "!! Table Header 1.1 !! Table Header 1.2\n" |
| 113 |
|
+ ":: Cell 2.1 :: Cell 2.2 (((\n" |
| 114 |
|
+ "== Embedded document ==\n" |
| 115 |
|
+ "This is an embedded document:\n" |
| 116 |
|
+ "* item X\n" |
| 117 |
|
+ "* item Y\n" |
| 118 |
|
+ "))) The text goes after the embedded\n" |
| 119 |
|
+ " document\n" |
| 120 |
|
+ ":: Cell 3.1 :: Cell 3.2"); |
| 121 |
1 |
test("----------------------------------------------\n" |
| 122 |
|
+ "= Example1 =\n" |
| 123 |
|
+ "\n" |
| 124 |
|
+ "The table below contains an embedded document.\n" |
| 125 |
|
+ "Using such embedded documents you can insert table\n" |
| 126 |
|
+ "in a list or a list in a table. And embedded documents\n" |
| 127 |
|
+ "can contain their own embedded documents!!!\n" |
| 128 |
|
+ "\n" |
| 129 |
|
+ "!! Header 1.1 !! Header 1.2\n" |
| 130 |
|
+ ":: Cell 2.1 :: Cell 2.2 with an embedded document: (((\n" |
| 131 |
|
+ "== This is an embedded document! ==\n" |
| 132 |
|
+ "* list item one\n" |
| 133 |
|
+ "* list item two\n" |
| 134 |
|
+ " * sub-item A\n" |
| 135 |
|
+ " * sub-item B\n" |
| 136 |
|
+ "* list item three\n" |
| 137 |
|
+ ")))\n" |
| 138 |
|
+ ":: Cell 3.1 :: Cell 3.2\n" |
| 139 |
|
+ "\n" |
| 140 |
|
+ "This is a paragraphs after the table...\n" |
| 141 |
|
+ "----------------------------------------------\n" |
| 142 |
|
+ ""); |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
|
| 146 |
|
@throws |
| 147 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
| 148 |
1 |
public void testDocuments() throws WikiParserException... |
| 149 |
|
{ |
| 150 |
1 |
test("before ((( inside ))) after ", "<p>before</p>\n" |
| 151 |
|
+ "<div class='wikimodel-document'>\n" |
| 152 |
|
+ "<p>inside</p>\n" |
| 153 |
|
+ "</div>\n" |
| 154 |
|
+ "<p>after </p>"); |
| 155 |
1 |
test("before inside ))) after ", "<p>before inside</p>\n" |
| 156 |
|
+ "<p>after </p>"); |
| 157 |
1 |
test("before (((\ninside ))) after ", "<p>before</p>\n" |
| 158 |
|
+ "<div class='wikimodel-document'>\n" |
| 159 |
|
+ "<p>inside</p>\n" |
| 160 |
|
+ "</div>\n" |
| 161 |
|
+ "<p>after </p>"); |
| 162 |
1 |
test("before (((\n inside ))) after ", "<p>before</p>\n" |
| 163 |
|
+ "<div class='wikimodel-document'>\n" |
| 164 |
|
+ "<p> inside</p>\n" |
| 165 |
|
+ "</div>\n" |
| 166 |
|
+ "<p>after </p>"); |
| 167 |
1 |
test( |
| 168 |
|
"| Line One | First doc: (((\n inside ))) after \n" |
| 169 |
|
+ "|Line Two | Second doc: (((lkjlj))) skdjg", |
| 170 |
|
"" |
| 171 |
|
+ "<table><tbody>\n" |
| 172 |
|
+ " <tr><td> Line One </td><td> First doc:<div class='wikimodel-document'>\n" |
| 173 |
|
+ "<p> inside</p>\n" |
| 174 |
|
+ "</div>\n" |
| 175 |
|
+ "after </td></tr>\n" |
| 176 |
|
+ " <tr><td>Line Two </td><td> Second doc:<div class='wikimodel-document'>\n" |
| 177 |
|
+ "<p>lkjlj</p>\n" |
| 178 |
|
+ "</div>\n" |
| 179 |
|
+ "skdjg</td></tr>\n" |
| 180 |
|
+ "</tbody></table>"); |
| 181 |
1 |
test( |
| 182 |
|
"| This is a table: | (((* item one\n" |
| 183 |
|
+ "* item two\n" |
| 184 |
|
+ " * subitem 1\n" |
| 185 |
|
+ " * subitem 2\n" |
| 186 |
|
+ "* item three))) ", |
| 187 |
|
"" |
| 188 |
|
+ "<table><tbody>\n" |
| 189 |
|
+ " <tr><td> This is a table: </td><td><div class='wikimodel-document'>\n" |
| 190 |
|
+ "<ul>\n" |
| 191 |
|
+ " <li>item one</li>\n" |
| 192 |
|
+ " <li>item two<ul>\n" |
| 193 |
|
+ " <li>subitem 1</li>\n" |
| 194 |
|
+ " <li>subitem 2</li>\n" |
| 195 |
|
+ "</ul>\n" |
| 196 |
|
+ "</li>\n" |
| 197 |
|
+ " <li>item three</li>\n" |
| 198 |
|
+ "</ul>\n" |
| 199 |
|
+ "</div>\n" |
| 200 |
|
+ "</td></tr>\n" |
| 201 |
|
+ "</tbody></table>"); |
| 202 |
1 |
test("before ((( opened and not closed", "" |
| 203 |
|
+ "<p>before</p>\n" |
| 204 |
|
+ "<div class='wikimodel-document'>\n" |
| 205 |
|
+ "<p>opened and not closed</p>\n" |
| 206 |
|
+ "</div>"); |
| 207 |
1 |
test("before ((( one ((( two ((( three ", "" |
| 208 |
|
+ "<p>before</p>\n" |
| 209 |
|
+ "<div class='wikimodel-document'>\n" |
| 210 |
|
+ "<p>one</p>\n" |
| 211 |
|
+ "<div class='wikimodel-document'>\n" |
| 212 |
|
+ "<p>two</p>\n" |
| 213 |
|
+ "<div class='wikimodel-document'>\n" |
| 214 |
|
+ "<p>three </p>\n" |
| 215 |
|
+ "</div>\n" |
| 216 |
|
+ "</div>\n" |
| 217 |
|
+ "</div>"); |
| 218 |
|
} |
| 219 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 220 |
1 |
public void testDocumentSections() throws WikiParserException... |
| 221 |
|
{ |
| 222 |
1 |
showSections(true); |
| 223 |
1 |
test("abc", "" |
| 224 |
|
+ "<section-1-0>\n" |
| 225 |
|
+ "<sectionContent-1-0>\n" |
| 226 |
|
+ "<p>abc</p>\n" |
| 227 |
|
+ "</sectionContent-1-0>\n" |
| 228 |
|
+ "</section-1-0>"); |
| 229 |
1 |
test("=Header=\n" + "abc", "" |
| 230 |
|
+ "<section-1-0>\n" |
| 231 |
|
+ "<sectionContent-1-0>\n" |
| 232 |
|
+ "<section-1-1>\n" |
| 233 |
|
+ "<h1>Header</h1>\n" |
| 234 |
|
+ "<sectionContent-1-1>\n" |
| 235 |
|
+ "<p>abc</p>\n" |
| 236 |
|
+ "</sectionContent-1-1>\n" |
| 237 |
|
+ "</section-1-1>\n" |
| 238 |
|
+ "</sectionContent-1-0>\n" |
| 239 |
|
+ "</section-1-0>"); |
| 240 |
1 |
test("=Header 1=\nabc\n=Header 2=\ncde", "" |
| 241 |
|
+ "<section-1-0>\n" |
| 242 |
|
+ "<sectionContent-1-0>\n" |
| 243 |
|
+ "" |
| 244 |
|
|
| 245 |
|
+ "<section-1-1>\n" |
| 246 |
|
+ "<h1>Header 1</h1>\n" |
| 247 |
|
+ "<sectionContent-1-1>\n" |
| 248 |
|
+ "<p>abc</p>\n" |
| 249 |
|
+ "</sectionContent-1-1>\n" |
| 250 |
|
+ "</section-1-1>\n" |
| 251 |
|
+ "" |
| 252 |
|
|
| 253 |
|
+ "<section-1-1>\n" |
| 254 |
|
+ "<h1>Header 2</h1>\n" |
| 255 |
|
+ "<sectionContent-1-1>\n" |
| 256 |
|
+ "<p>cde</p>\n" |
| 257 |
|
+ "</sectionContent-1-1>\n" |
| 258 |
|
+ "</section-1-1>\n" |
| 259 |
|
+ "" |
| 260 |
|
+ "</sectionContent-1-0>\n" |
| 261 |
|
+ "</section-1-0>"); |
| 262 |
1 |
test("" |
| 263 |
|
+ "=Header 1=\nabc\n" |
| 264 |
|
+ "==Header 1.1==\ncde\n" |
| 265 |
|
+ "==Header 1.2==\nefg\n" |
| 266 |
|
+ "=Header 2=\nghk", "" |
| 267 |
|
+ "<section-1-0>\n" |
| 268 |
|
+ "<sectionContent-1-0>\n" |
| 269 |
|
+ "" |
| 270 |
|
|
| 271 |
|
+ "<section-1-1>\n" |
| 272 |
|
+ "<h1>Header 1</h1>\n" |
| 273 |
|
+ "<sectionContent-1-1>\n" |
| 274 |
|
|
| 275 |
|
+ "<p>abc</p>\n" |
| 276 |
|
+ "<section-1-2>\n" |
| 277 |
|
+ "<h2>Header 1.1</h2>\n" |
| 278 |
|
+ "<sectionContent-1-2>\n" |
| 279 |
|
+ "<p>cde</p>\n" |
| 280 |
|
+ "</sectionContent-1-2>\n" |
| 281 |
|
+ "</section-1-2>\n" |
| 282 |
|
|
| 283 |
|
+ "<section-1-2>\n" |
| 284 |
|
+ "<h2>Header 1.2</h2>\n" |
| 285 |
|
+ "<sectionContent-1-2>\n" |
| 286 |
|
+ "<p>efg</p>\n" |
| 287 |
|
+ "</sectionContent-1-2>\n" |
| 288 |
|
+ "</section-1-2>\n" |
| 289 |
|
+ "" |
| 290 |
|
+ "</sectionContent-1-1>\n" |
| 291 |
|
+ "</section-1-1>\n" |
| 292 |
|
+ "" |
| 293 |
|
|
| 294 |
|
+ "<section-1-1>\n" |
| 295 |
|
+ "<h1>Header 2</h1>\n" |
| 296 |
|
+ "<sectionContent-1-1>\n" |
| 297 |
|
+ "<p>ghk</p>\n" |
| 298 |
|
+ "</sectionContent-1-1>\n" |
| 299 |
|
+ "</section-1-1>\n" |
| 300 |
|
+ "" |
| 301 |
|
+ "</sectionContent-1-0>\n" |
| 302 |
|
+ "</section-1-0>"); |
| 303 |
|
|
| 304 |
|
|
| 305 |
|
|
| 306 |
1 |
test("((()))", "" |
| 307 |
|
+ "<section-1-0>\n" |
| 308 |
|
+ "<sectionContent-1-0>\n" |
| 309 |
|
+ "<div class='wikimodel-document'>\n" |
| 310 |
|
+ "<section-2-0>\n" |
| 311 |
|
+ "<sectionContent-2-0>\n" |
| 312 |
|
+ "</sectionContent-2-0>\n" |
| 313 |
|
+ "</section-2-0>\n" |
| 314 |
|
+ "</div>\n" |
| 315 |
|
+ "</sectionContent-1-0>\n" |
| 316 |
|
+ "</section-1-0>"); |
| 317 |
1 |
test("" |
| 318 |
|
+ "=Header 1=\nabc\n" |
| 319 |
|
+ "(((" |
| 320 |
|
+ "=Header 1.1=\ncde\n" |
| 321 |
|
+ "=Header 1.2=\nefg\n" |
| 322 |
|
+ ")))\n" |
| 323 |
|
+ "xyz\n" |
| 324 |
|
+ "=Header 2=\nghk", "" |
| 325 |
|
+ "" |
| 326 |
|
+ "<section-1-0>\n" |
| 327 |
|
+ "<sectionContent-1-0>\n" |
| 328 |
|
|
| 329 |
|
+ "<section-1-1>\n" |
| 330 |
|
+ "<h1>Header 1</h1>\n" |
| 331 |
|
+ "<sectionContent-1-1>\n" |
| 332 |
|
+ "<p>abc</p>\n" |
| 333 |
|
+ "" |
| 334 |
|
|
| 335 |
|
+ "<div class='wikimodel-document'>\n" |
| 336 |
|
+ "<section-2-0>\n" |
| 337 |
|
+ "<sectionContent-2-0>\n" |
| 338 |
|
|
| 339 |
|
+ "<section-2-1>\n" |
| 340 |
|
+ "<h1>Header 1.1</h1>\n" |
| 341 |
|
+ "<sectionContent-2-1>\n" |
| 342 |
|
+ "<p>cde</p>\n" |
| 343 |
|
+ "</sectionContent-2-1>\n" |
| 344 |
|
+ "</section-2-1>\n" |
| 345 |
|
|
| 346 |
|
+ "<section-2-1>\n" |
| 347 |
|
+ "<h1>Header 1.2</h1>\n" |
| 348 |
|
+ "<sectionContent-2-1>\n" |
| 349 |
|
+ "<p>efg</p>\n" |
| 350 |
|
+ "</sectionContent-2-1>\n" |
| 351 |
|
+ "</section-2-1>\n" |
| 352 |
|
|
| 353 |
|
+ "</sectionContent-2-0>\n" |
| 354 |
|
+ "</section-2-0>\n" |
| 355 |
|
+ "</div>\n" |
| 356 |
|
+ "<p>xyz</p>\n" |
| 357 |
|
+ "</sectionContent-1-1>\n" |
| 358 |
|
+ "</section-1-1>\n" |
| 359 |
|
+ "" |
| 360 |
|
|
| 361 |
|
+ "<section-1-1>\n" |
| 362 |
|
+ "<h1>Header 2</h1>\n" |
| 363 |
|
+ "<sectionContent-1-1>\n" |
| 364 |
|
+ "<p>ghk</p>\n" |
| 365 |
|
+ "</sectionContent-1-1>\n" |
| 366 |
|
+ "</section-1-1>\n" |
| 367 |
|
+ "" |
| 368 |
|
+ "</sectionContent-1-0>\n" |
| 369 |
|
+ "</section-1-0>"); |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
|
| 373 |
|
@throws |
| 374 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 375 |
1 |
public void testEscape() throws WikiParserException... |
| 376 |
|
{ |
| 377 |
1 |
test("[a reference]"); |
| 378 |
1 |
test("\\[not a reference]"); |
| 379 |
|
|
| 380 |
1 |
test("\\First letter is escaped"); |
| 381 |
1 |
test("\\[not a reference]"); |
| 382 |
1 |
test("\\\\escaped backslash"); |
| 383 |
1 |
test("\\ a line break because it is followed by a space"); |
| 384 |
|
|
| 385 |
1 |
test("= Heading =\n\\= Not a heading =\n= Heading again! ="); |
| 386 |
|
} |
| 387 |
|
|
| 388 |
|
|
| 389 |
|
@throws |
| 390 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
| 391 |
1 |
public void testExtensions() throws WikiParserException... |
| 392 |
|
{ |
| 393 |
|
|
| 394 |
1 |
test( |
| 395 |
|
" $abc ", |
| 396 |
|
"<p> <span class='wikimodel-extension' extension='abc'/> </p>"); |
| 397 |
1 |
test( |
| 398 |
|
"abc $abc after", |
| 399 |
|
"<p>abc <span class='wikimodel-extension' extension='abc'/> after</p>"); |
| 400 |
1 |
test( |
| 401 |
|
"abc $abc() after", |
| 402 |
|
"<p>abc <span class='wikimodel-extension' extension='abc'/> after</p>"); |
| 403 |
1 |
test( |
| 404 |
|
"abc $abc(a=b c=d) after", |
| 405 |
|
"<p>abc <span class='wikimodel-extension' extension='abc' a='b' c='d'/> after</p>"); |
| 406 |
1 |
test( |
| 407 |
|
"before$abc(hello)after", |
| 408 |
|
"<p>before<span class='wikimodel-extension' extension='abc' hello=''/>after</p>"); |
| 409 |
|
|
| 410 |
|
|
| 411 |
1 |
test("$abc", "<div class='wikimodel-extension' extension='abc'/>"); |
| 412 |
1 |
test("$abc()", "<div class='wikimodel-extension' extension='abc'/>"); |
| 413 |
1 |
test( |
| 414 |
|
"$abc(a=b c=d)", |
| 415 |
|
"<div class='wikimodel-extension' extension='abc' a='b' c='d'/>"); |
| 416 |
1 |
test( |
| 417 |
|
"$abc(a)", |
| 418 |
|
"<div class='wikimodel-extension' extension='abc' a=''/>"); |
| 419 |
|
|
| 420 |
1 |
test("before\n$abc after", "" |
| 421 |
|
+ "<p>before</p>\n" |
| 422 |
|
+ "<div class='wikimodel-extension' extension='abc'/>\n" |
| 423 |
|
+ "<p> after</p>"); |
| 424 |
1 |
test("before\n$abc() after", "" |
| 425 |
|
+ "<p>before</p>\n" |
| 426 |
|
+ "<div class='wikimodel-extension' extension='abc'/>\n" |
| 427 |
|
+ "<p> after</p>"); |
| 428 |
1 |
test( |
| 429 |
|
"before\n$abc(a=b c=d) after", |
| 430 |
|
"" |
| 431 |
|
+ "<p>before</p>\n" |
| 432 |
|
+ "<div class='wikimodel-extension' extension='abc' a='b' c='d'/>\n" |
| 433 |
|
+ "<p> after</p>"); |
| 434 |
1 |
test("before\n$abc(hello)after", "" |
| 435 |
|
+ "<p>before</p>\n" |
| 436 |
|
+ "<div class='wikimodel-extension' extension='abc' hello=''/>\n" |
| 437 |
|
+ "<p>after</p>"); |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
|
| 441 |
|
@throws |
| 442 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
| 443 |
1 |
public void testFormats() throws WikiParserException... |
| 444 |
|
{ |
| 445 |
1 |
test("*bold* ", "<p><strong>bold</strong> </p>"); |
| 446 |
1 |
test(" **bold** ", "<p> <strong>bold</strong> </p>"); |
| 447 |
1 |
test("__italic__", "<p><em>italic</em></p>"); |
| 448 |
|
|
| 449 |
1 |
test("*strong*", "<p><strong>strong</strong></p>"); |
| 450 |
1 |
test(" *strong*", "<p> <strong>strong</strong></p>"); |
| 451 |
1 |
test("__em__", "<p><em>em</em></p>"); |
| 452 |
1 |
test("$$code$$", "<p><code>code</code></p>"); |
| 453 |
1 |
test("^^sup^^", "<p><sup>sup</sup></p>"); |
| 454 |
1 |
test("~~sub~~", "<p><sub>sub</sub></p>"); |
| 455 |
|
|
| 456 |
|
|
| 457 |
|
|
| 458 |
1 |
test("before++big++after", "<p>before<big>big</big>after</p>"); |
| 459 |
1 |
test("before--small--after", "<p>before<small>small</small>after</p>"); |
| 460 |
|
|
| 461 |
1 |
test("@@ins@@", "<p><ins>ins</ins></p>"); |
| 462 |
1 |
test("##del##", "<p><del>del</del></p>"); |
| 463 |
|
|
| 464 |
1 |
test( |
| 465 |
|
"before*bold*__italic__^^superscript^^~~subscript~~value after", |
| 466 |
|
"<p>before<strong>bold</strong><em>italic</em>" |
| 467 |
|
+ "<sup>superscript</sup><sub>subscript</sub>" |
| 468 |
|
+ "value after</p>"); |
| 469 |
|
|
| 470 |
|
|
| 471 |
1 |
test("normal*bold__bold-italic*italic__normal", "<p>" |
| 472 |
|
+ "normal<strong>bold</strong>" |
| 473 |
|
+ "<strong><em>bold-italic</em></strong>" |
| 474 |
|
+ "<em>italic</em>normal" |
| 475 |
|
+ "</p>"); |
| 476 |
|
|
| 477 |
|
|
| 478 |
1 |
test("not a bold__", "<p>not a bold</p>"); |
| 479 |
1 |
test("not an italic__", "<p>not an italic</p>"); |
| 480 |
|
|
| 481 |
1 |
test("text*", "<p>text</p>"); |
| 482 |
1 |
test("text**", "<p>text</p>"); |
| 483 |
1 |
test("text__", "<p>text</p>"); |
| 484 |
1 |
test("text$$", "<p>text</p>"); |
| 485 |
1 |
test("text^^", "<p>text</p>"); |
| 486 |
1 |
test("text~~", "<p>text</p>"); |
| 487 |
|
} |
| 488 |
|
|
| 489 |
|
|
| 490 |
|
@throws |
| 491 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
| 492 |
1 |
public void testHeaders() throws WikiParserException... |
| 493 |
|
{ |
| 494 |
1 |
test("=Header1=", "<h1>Header1</h1>"); |
| 495 |
1 |
test("==Header2==", "<h2>Header2</h2>"); |
| 496 |
1 |
test("===Header3===", "<h3>Header3</h3>"); |
| 497 |
1 |
test("====Header4====", "<h4>Header4</h4>"); |
| 498 |
1 |
test("=Header1", "<h1>Header1</h1>"); |
| 499 |
1 |
test("==Header2", "<h2>Header2</h2>"); |
| 500 |
1 |
test("===Header3", "<h3>Header3</h3>"); |
| 501 |
1 |
test("====Header4", "<h4>Header4</h4>"); |
| 502 |
1 |
test("before\n= Header =\nafter", "<p>before</p>\n" |
| 503 |
|
+ "<h1>Header </h1>\n" |
| 504 |
|
+ "<p>after</p>"); |
| 505 |
|
|
| 506 |
1 |
test("This is not a header: ==", "<p>This is not a header: ==</p>"); |
| 507 |
|
|
| 508 |
1 |
test("{{a=b}}\n=Header1", "<h1 a='b'>Header1</h1>"); |
| 509 |
|
} |
| 510 |
|
|
| 511 |
|
|
| 512 |
|
@throws |
| 513 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 514 |
1 |
public void testHorLine() throws WikiParserException... |
| 515 |
|
{ |
| 516 |
1 |
test("----", "<hr />"); |
| 517 |
1 |
test("-------", "<hr />"); |
| 518 |
1 |
test("-----------", "<hr />"); |
| 519 |
1 |
test("----\nabc", "<hr />\n<p>abc</p>"); |
| 520 |
1 |
test("before\n----\nafter", "<p>before</p>\n<hr />\n<p>after</p>"); |
| 521 |
1 |
test("{{a=b}}\n----", "<hr a='b' />"); |
| 522 |
|
|
| 523 |
|
|
| 524 |
1 |
test(" -----------", "<p> ---------</p>"); |
| 525 |
|
} |
| 526 |
|
|
| 527 |
|
|
| 528 |
|
@throws |
| 529 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 530 |
1 |
public void testInfo() throws WikiParserException... |
| 531 |
|
{ |
| 532 |
1 |
test("/i\\ item {{{formatted block}}} {macro}123{/macro} after"); |
| 533 |
1 |
test("before\n" |
| 534 |
|
+ "/i\\Information block:\n" |
| 535 |
|
+ "{{{pre\n" |
| 536 |
|
+ " formatted\n" |
| 537 |
|
+ " block}}} sdlkgj\n" |
| 538 |
|
+ "qsdg\n\n" |
| 539 |
|
+ "after"); |
| 540 |
1 |
test("/!\\"); |
| 541 |
1 |
test("/i\\info"); |
| 542 |
1 |
test("/i\\Information block:\n" |
| 543 |
|
+ "first line\n" |
| 544 |
|
+ "second line\n" |
| 545 |
|
+ "third line"); |
| 546 |
1 |
test("{{a=b}}\n/!\\"); |
| 547 |
1 |
test("{{a=b}}\n/i\\info"); |
| 548 |
|
} |
| 549 |
|
|
| 550 |
|
|
| 551 |
|
@throws |
| 552 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
| 553 |
1 |
public void testLineBreak() throws WikiParserException... |
| 554 |
|
{ |
| 555 |
1 |
test("abc\\\ndef"); |
| 556 |
1 |
test("abc\\ \ndef"); |
| 557 |
1 |
test("abc\\ x \ndef"); |
| 558 |
1 |
test("abc x \ndef"); |
| 559 |
|
} |
| 560 |
|
|
| 561 |
|
|
| 562 |
|
@throws |
| 563 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
| 564 |
1 |
public void testLists() throws WikiParserException... |
| 565 |
|
{ |
| 566 |
1 |
test( |
| 567 |
|
"*this is a bold, and not a list", |
| 568 |
|
"<p><strong>this is a bold, and not a list</strong></p>"); |
| 569 |
1 |
test("**bold**", "<p><strong>bold</strong></p>"); |
| 570 |
|
|
| 571 |
1 |
test("* first", "<ul>\n <li>first</li>\n</ul>"); |
| 572 |
1 |
test( |
| 573 |
|
"** second", |
| 574 |
|
"<ul>\n <li><ul>\n <li>second</li>\n</ul>\n</li>\n</ul>"); |
| 575 |
|
|
| 576 |
1 |
test("* item one\n" |
| 577 |
|
+ "* item two\n" |
| 578 |
|
+ "*+item three\n" |
| 579 |
|
+ "*+ item four\n" |
| 580 |
|
+ "* item five - first line\n" |
| 581 |
|
+ " item five - second line\n" |
| 582 |
|
+ "* item six\n" |
| 583 |
|
+ " is on multiple\n" |
| 584 |
|
+ " lines"); |
| 585 |
|
|
| 586 |
1 |
test( |
| 587 |
|
"* item {{{formatted block}}} {macro}123{/macro} after", |
| 588 |
|
"<ul>\n" |
| 589 |
|
+ " <li>item <tt class=\"wikimodel-verbatim\">formatted block</tt>" |
| 590 |
|
+ " <span class='wikimodel-macro' macroName='macro'><![CDATA[123]]></span> after</li>\n</ul>"); |
| 591 |
|
|
| 592 |
1 |
test("? term: definition"); |
| 593 |
1 |
test("?just term"); |
| 594 |
1 |
test(":just definition"); |
| 595 |
1 |
test(";:just definition"); |
| 596 |
1 |
test(":just definition"); |
| 597 |
1 |
test(";:"); |
| 598 |
1 |
test(": Indenting is stripped out.\n" + " : Includes double indenting"); |
| 599 |
|
|
| 600 |
1 |
test(";term one: definition one\n" |
| 601 |
|
+ ";term two: definition two\n" |
| 602 |
|
+ ";term three: definition three"); |
| 603 |
1 |
test(":Term definition"); |
| 604 |
1 |
test(";:Term definition"); |
| 605 |
|
|
| 606 |
1 |
test(";One,\ntwo,\nbucle my shoes...:\n" |
| 607 |
|
+ "...Three\nfour,\nClose the door\n" |
| 608 |
|
+ ";Five,\nSix: Pick up\n sticks\n\ntam-tam, pam-pam..."); |
| 609 |
|
|
| 610 |
1 |
test(";__term__: *definition*"); |
| 611 |
|
|
| 612 |
1 |
test("this is not a definition --\n" |
| 613 |
|
+ " ;__not__ a term: ''not'' a definition\n" |
| 614 |
|
+ "----toto"); |
| 615 |
|
|
| 616 |
1 |
test("{{a='b'}}\n* item one"); |
| 617 |
|
} |
| 618 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (35) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 619 |
1 |
public void testMacro() throws WikiParserException... |
| 620 |
|
{ |
| 621 |
1 |
test( |
| 622 |
|
"{toto}a{/toto}", |
| 623 |
|
"<pre class='wikimodel-macro' macroName='toto'><![CDATA[a]]></pre>"); |
| 624 |
1 |
test( |
| 625 |
|
"{toto}a{toto}b{/toto}c{/toto}", |
| 626 |
|
"<pre class='wikimodel-macro' macroName='toto'><![CDATA[a{toto}b{/toto}c]]></pre>"); |
| 627 |
1 |
test( |
| 628 |
|
"before\n{toto}a{/toto}\nafter", |
| 629 |
|
"" |
| 630 |
|
+ "<p>before</p>\n" |
| 631 |
|
+ "<pre class='wikimodel-macro' macroName='toto'><![CDATA[a]]></pre>\n" |
| 632 |
|
+ "<p>after</p>"); |
| 633 |
1 |
test( |
| 634 |
|
"before\n{toto}a{/toto}after", |
| 635 |
|
"" |
| 636 |
|
+ "<p>before</p>\n" |
| 637 |
|
+ "<pre class='wikimodel-macro' macroName='toto'><![CDATA[a]]></pre>\n" |
| 638 |
|
+ "<p>after</p>"); |
| 639 |
|
|
| 640 |
|
|
| 641 |
1 |
test( |
| 642 |
|
"{x:toto}a{/x:toto}", |
| 643 |
|
"<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[a]]></pre>"); |
| 644 |
1 |
test( |
| 645 |
|
"{x:toto}a{x:toto}b{/x:toto}c{/x:toto}", |
| 646 |
|
"<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[a{x:toto}b{/x:toto}c]]></pre>"); |
| 647 |
1 |
test( |
| 648 |
|
"before\n{x:toto}a{/x:toto}\nafter", |
| 649 |
|
"" |
| 650 |
|
+ "<p>before</p>\n" |
| 651 |
|
+ "<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[a]]></pre>\n" |
| 652 |
|
+ "<p>after</p>"); |
| 653 |
1 |
test( |
| 654 |
|
"before\n{x:toto}a{/x:toto}after", |
| 655 |
|
"" |
| 656 |
|
+ "<p>before</p>\n" |
| 657 |
|
+ "<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[a]]></pre>\n" |
| 658 |
|
+ "<p>after</p>"); |
| 659 |
|
|
| 660 |
|
|
| 661 |
1 |
test( |
| 662 |
|
"{x:toto /}", |
| 663 |
|
"<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[]]></pre>"); |
| 664 |
1 |
test( |
| 665 |
|
"{x:toto a=b c=d /}", |
| 666 |
|
"<pre class='wikimodel-macro' macroName='x:toto' a='b' c='d'><![CDATA[]]></pre>"); |
| 667 |
1 |
test( |
| 668 |
|
"before\n{x:toto a=b c=d/}\nafter", |
| 669 |
|
"" |
| 670 |
|
+ "<p>before</p>\n" |
| 671 |
|
+ "<pre class='wikimodel-macro' macroName='x:toto' a='b' c='d'><![CDATA[]]></pre>\n" |
| 672 |
|
+ "<p>after</p>"); |
| 673 |
1 |
test( |
| 674 |
|
"before\n{x:toto a='b' c='d'/}after", |
| 675 |
|
"" |
| 676 |
|
+ "<p>before</p>\n" |
| 677 |
|
+ "<pre class='wikimodel-macro' macroName='x:toto' a='b' c='d'><![CDATA[]]></pre>\n" |
| 678 |
|
+ "<p>after</p>"); |
| 679 |
1 |
test( |
| 680 |
|
"before{x:toto /}after", |
| 681 |
|
"<p>before<span class='wikimodel-macro' macroName='x:toto'><![CDATA[]]></span>after</p>"); |
| 682 |
|
|
| 683 |
|
|
| 684 |
1 |
test( |
| 685 |
|
"{toto}", |
| 686 |
|
"<pre class='wikimodel-macro' macroName='toto'><![CDATA[]]></pre>"); |
| 687 |
1 |
test( |
| 688 |
|
"{toto}a{toto}", |
| 689 |
|
"<pre class='wikimodel-macro' macroName='toto'><![CDATA[a{toto}]]></pre>"); |
| 690 |
|
|
| 691 |
|
|
| 692 |
1 |
test( |
| 693 |
|
"{toto}a{/toto}", |
| 694 |
|
"<pre class='wikimodel-macro' macroName='toto'><![CDATA[a]]></pre>"); |
| 695 |
1 |
test( |
| 696 |
|
"before{toto}macro{/toto}after", |
| 697 |
|
"<p>before<span class='wikimodel-macro' macroName='toto'><![CDATA[macro]]></span>after</p>"); |
| 698 |
|
|
| 699 |
1 |
test( |
| 700 |
|
"before{toto a=b c=d}toto macro tata {/toto}after", |
| 701 |
|
"" |
| 702 |
|
+ "<p>before<span class='wikimodel-macro' macroName='toto' a='b' c='d'>" |
| 703 |
|
+ "<![CDATA[toto macro tata ]]>" |
| 704 |
|
+ "</span>after</p>"); |
| 705 |
|
|
| 706 |
1 |
test( |
| 707 |
|
"before{toto a=b c=d}toto {x qsdk} macro {sd} tata {/toto}after", |
| 708 |
|
"" |
| 709 |
|
+ "<p>before<span class='wikimodel-macro' macroName='toto' a='b' c='d'>" |
| 710 |
|
+ "<![CDATA[toto {x qsdk} macro {sd} tata ]]>" |
| 711 |
|
+ "</span>after</p>"); |
| 712 |
|
|
| 713 |
|
|
| 714 |
1 |
test( |
| 715 |
|
"- before\n{code a=b c=d}this is a code{/code}after", |
| 716 |
|
"" |
| 717 |
|
+ "<ul>\n" |
| 718 |
|
+ " <li>before<pre class='wikimodel-macro' macroName='code' a='b' c='d'>" |
| 719 |
|
+ "<![CDATA[this is a code]]></pre>\n" |
| 720 |
|
+ "after</li>\n" |
| 721 |
|
+ "</ul>"); |
| 722 |
1 |
test( |
| 723 |
|
"- before{code a=b c=d}this is a code{/code}after", |
| 724 |
|
"" |
| 725 |
|
+ "<ul>\n" |
| 726 |
|
+ " <li>before<span class='wikimodel-macro' macroName='code' a='b' c='d'>" |
| 727 |
|
+ "<![CDATA[this is a code]]></span>after</li>\n" |
| 728 |
|
+ "</ul>"); |
| 729 |
|
|
| 730 |
|
|
| 731 |
1 |
test("{ toto a=b c=d}", "<p>{ toto a=b c=d}</p>"); |
| 732 |
|
|
| 733 |
|
|
| 734 |
1 |
test( |
| 735 |
|
"This is a macro: {toto x:a=b x:c=d}\n" |
| 736 |
|
+ "<table>\n" |
| 737 |
|
+ "#foreach ($x in $table)\n" |
| 738 |
|
+ " <tr>hello, $x</tr>\n" |
| 739 |
|
+ "#end\n" |
| 740 |
|
+ "</table>\n" |
| 741 |
|
+ "{/toto}\n\n" |
| 742 |
|
+ "And this is a usage of this macro: $toto(a=x b=y)", |
| 743 |
|
"<p>This is a macro: <span class='wikimodel-macro' macroName='toto' x:a='b' x:c='d'><![CDATA[\n" |
| 744 |
|
+ "<table>\n" |
| 745 |
|
+ "#foreach ($x in $table)\n" |
| 746 |
|
+ " <tr>hello, $x</tr>\n" |
| 747 |
|
+ "#end\n" |
| 748 |
|
+ "</table>\n" |
| 749 |
|
+ "]]></span></p>\n" |
| 750 |
|
+ |
| 751 |
|
"<p>And this is a usage of this macro: <span class='wikimodel-extension' extension='toto' a='x' b='y'/></p>"); |
| 752 |
|
|
| 753 |
1 |
test( |
| 754 |
|
"!!Header:: Cell with a macro: \n" |
| 755 |
|
+ "{code}this is a code{/code} \n" |
| 756 |
|
+ " this is afer the code...", |
| 757 |
|
"" |
| 758 |
|
+ "<table><tbody>\n" |
| 759 |
|
+ " <tr><th>Header</th><td> Cell with a macro: " |
| 760 |
|
+ "<pre class='wikimodel-macro' macroName='code'><![CDATA[this is a code]]></pre>\n \n" |
| 761 |
|
+ " this is afer the code...</td></tr>\n" |
| 762 |
|
+ "</tbody></table>"); |
| 763 |
1 |
test( |
| 764 |
|
"" |
| 765 |
|
+ "* item one\n" |
| 766 |
|
+ "* item two\n" |
| 767 |
|
+ " * subitem with a macro:\n" |
| 768 |
|
+ " {code} this is a code{/code} \n" |
| 769 |
|
+ " the same item (continuation)\n" |
| 770 |
|
+ " * subitem two\n" |
| 771 |
|
+ "* item three", |
| 772 |
|
"" |
| 773 |
|
+ "<ul>\n" |
| 774 |
|
+ " <li>item one</li>\n" |
| 775 |
|
+ " <li>item two<ul>\n" |
| 776 |
|
+ " <li>subitem with a macro:\n" |
| 777 |
|
+ " <span class='wikimodel-macro' macroName='code'><![CDATA[ this is a code]]></span> \n" |
| 778 |
|
+ " the same item (continuation)</li>\n" |
| 779 |
|
+ " <li>subitem two</li>\n" |
| 780 |
|
+ "</ul>\n" |
| 781 |
|
+ "</li>\n" |
| 782 |
|
+ " <li>item three</li>\n" |
| 783 |
|
+ "</ul>"); |
| 784 |
|
|
| 785 |
|
|
| 786 |
1 |
test( |
| 787 |
|
"{x:y a=b c=d}", |
| 788 |
|
"<pre class='wikimodel-macro' macroName='x:y' a='b' c='d'><![CDATA[]]></pre>"); |
| 789 |
1 |
test( |
| 790 |
|
"before{x:y a=b c=d}macro content", |
| 791 |
|
"<p>before<span class='wikimodel-macro' macroName='x:y' a='b' c='d'><![CDATA[macro content]]></span></p>"); |
| 792 |
1 |
test( |
| 793 |
|
"before\n{x:y a=b c=d}macro content", |
| 794 |
|
"" |
| 795 |
|
+ "<p>before</p>\n" |
| 796 |
|
+ "<pre class='wikimodel-macro' macroName='x:y' a='b' c='d'><![CDATA[macro content]]></pre>"); |
| 797 |
1 |
test( |
| 798 |
|
"before\n{x:y a=b c=d/}\nafter", |
| 799 |
|
"" |
| 800 |
|
+ "<p>before</p>\n" |
| 801 |
|
+ "<pre class='wikimodel-macro' macroName='x:y' a='b' c='d'><![CDATA[]]></pre>\n" |
| 802 |
|
+ "<p>after</p>"); |
| 803 |
|
|
| 804 |
|
|
| 805 |
1 |
test( |
| 806 |
|
"a{a}{b}", |
| 807 |
|
"<p>a<span class='wikimodel-macro' macroName='a'><![CDATA[{b}]]></span></p>"); |
| 808 |
1 |
test( |
| 809 |
|
"a{a}{b}{", |
| 810 |
|
"<p>a<span class='wikimodel-macro' macroName='a'><![CDATA[{b}{]]></span></p>"); |
| 811 |
1 |
test( |
| 812 |
|
"a {{x:}} b", |
| 813 |
|
"<p>a {<span class='wikimodel-macro' macroName='x:'><![CDATA[} b]]></span></p>"); |
| 814 |
1 |
test( |
| 815 |
|
"a {{x:}} }b", |
| 816 |
|
"<p>a {<span class='wikimodel-macro' macroName='x:'><![CDATA[} }b]]></span></p>"); |
| 817 |
|
|
| 818 |
1 |
test( |
| 819 |
|
"a {{x:}} {}b", |
| 820 |
|
"<p>a {<span class='wikimodel-macro' macroName='x:'><![CDATA[} {}b]]></span></p>"); |
| 821 |
1 |
test( |
| 822 |
|
"a {{x:}}, {{y:}} b", |
| 823 |
|
"<p>a {<span class='wikimodel-macro' macroName='x:'><![CDATA[}, {{y:}} b]]></span></p>"); |
| 824 |
|
} |
| 825 |
|
|
| 826 |
|
|
| 827 |
|
@throws |
| 828 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
| 829 |
1 |
public void testParagraphs() throws WikiParserException... |
| 830 |
|
{ |
| 831 |
1 |
test("{{background='blue'}}", "<p background='blue'></p>"); |
| 832 |
1 |
test("" |
| 833 |
|
+ "{{background='blue'}}\n" |
| 834 |
|
+ "{{background='red'}}\n" |
| 835 |
|
+ "{{background='green'}}", "" |
| 836 |
|
+ "<p background='blue'></p>\n" |
| 837 |
|
+ "<p background='red'></p>\n" |
| 838 |
|
+ "<p background='green'></p>"); |
| 839 |
1 |
test("" |
| 840 |
|
+ "{{background='blue'}}first\n" |
| 841 |
|
+ "{{background='red'}}second\n" |
| 842 |
|
+ "{{background='green'}}third", "" |
| 843 |
|
+ "<p background='blue'>first</p>\n" |
| 844 |
|
+ "<p background='red'>second</p>\n" |
| 845 |
|
+ "<p background='green'>third</p>"); |
| 846 |
1 |
test("" |
| 847 |
|
+ "{{background='blue'}}\nfirst\n" |
| 848 |
|
+ "{{background='red'}}\nsecond\n" |
| 849 |
|
+ "{{background='green'}}\nthird", "" |
| 850 |
|
+ "<p background='blue'>first</p>\n" |
| 851 |
|
+ "<p background='red'>second</p>\n" |
| 852 |
|
+ "<p background='green'>third</p>"); |
| 853 |
|
|
| 854 |
1 |
test("{{background='blue'}}hello", "<p background='blue'>hello</p>"); |
| 855 |
1 |
test("{{background='blue'}}\n" |
| 856 |
|
+ "First paragraph\n" |
| 857 |
|
+ "\n" |
| 858 |
|
+ "\n" |
| 859 |
|
+ "\n" |
| 860 |
|
+ "", "" |
| 861 |
|
+ "<p background='blue'>First paragraph</p>\n" |
| 862 |
|
+ "<div style='height:3em;'></div>"); |
| 863 |
|
|
| 864 |
1 |
test("First paragraph\n" + "\n" + "\n" + "\n" + ""); |
| 865 |
1 |
test("First paragraph.\n" |
| 866 |
|
+ "Second line of the same paragraph.\n" |
| 867 |
|
+ "\n" |
| 868 |
|
+ "The second paragraph"); |
| 869 |
|
|
| 870 |
1 |
test("\n<toto"); |
| 871 |
|
} |
| 872 |
|
|
| 873 |
|
|
| 874 |
|
@throws |
| 875 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
| 876 |
1 |
public void testPropertiesBlock() throws WikiParserException... |
| 877 |
|
{ |
| 878 |
1 |
test( |
| 879 |
|
"%toto hello world\n123", |
| 880 |
|
"<div class='wikimodel-property' url='toto'><p>hello world</p>\n</div>\n<p>123</p>"); |
| 881 |
1 |
test( |
| 882 |
|
"%prop1 value1\n%prop2 value2", |
| 883 |
|
"" |
| 884 |
|
+ "<div class='wikimodel-property' url='prop1'><p>value1</p>\n</div>\n" |
| 885 |
|
+ "<div class='wikimodel-property' url='prop2'><p>value2</p>\n</div>"); |
| 886 |
1 |
test( |
| 887 |
|
"%prop1 value1\nparagraph\n%prop2 value2", |
| 888 |
|
"" |
| 889 |
|
+ "<div class='wikimodel-property' url='prop1'><p>value1</p>\n</div>\n" |
| 890 |
|
+ "<p>paragraph</p>\n" |
| 891 |
|
+ "<div class='wikimodel-property' url='prop2'><p>value2</p>\n</div>"); |
| 892 |
|
|
| 893 |
1 |
test("%prop1 (((embedded)))next paragraph\n%prop2 value2", "" |
| 894 |
|
+ "<div class='wikimodel-property' url='prop1'>\n" |
| 895 |
|
+ "<p>embedded</p>\n" |
| 896 |
|
+ "</div>\n" |
| 897 |
|
+ "<p>next paragraph</p>\n" |
| 898 |
|
+ "<div class='wikimodel-property' url='prop2'><p>value2</p>\n" |
| 899 |
|
+ "</div>"); |
| 900 |
1 |
test( |
| 901 |
|
"%prop1 (((=Header\n- item 1\n- item 2)))next paragraph\n%prop2 value2", |
| 902 |
|
"" |
| 903 |
|
+ "<div class='wikimodel-property' url='prop1'>\n" |
| 904 |
|
+ "<h1>Header</h1>\n" |
| 905 |
|
+ "<ul>\n" |
| 906 |
|
+ " <li>item 1</li>\n" |
| 907 |
|
+ " <li>item 2</li>\n" |
| 908 |
|
+ "</ul>\n" |
| 909 |
|
+ "</div>\n" |
| 910 |
|
+ "<p>next paragraph</p>\n" |
| 911 |
|
+ "<div class='wikimodel-property' url='prop2'><p>value2</p>\n" |
| 912 |
|
+ "</div>"); |
| 913 |
|
|
| 914 |
1 |
test( |
| 915 |
|
"before\n" |
| 916 |
|
+ "\n" |
| 917 |
|
+ "%company (((\n" |
| 918 |
|
+ " %name Cognium Systems\n" |
| 919 |
|
+ " %addr (((\n" |
| 920 |
|
+ " %country [France]\n" |
| 921 |
|
+ " %city [Paris]\n" |
| 922 |
|
+ " %street Cité Nollez\n" |
| 923 |
|
+ " This is just a description...\n" |
| 924 |
|
+ " )))\n" |
| 925 |
|
+ ")))\n" |
| 926 |
|
+ "\n" |
| 927 |
|
+ "after", |
| 928 |
|
"" |
| 929 |
|
+ "<p>before</p>\n" |
| 930 |
|
+ "<div class='wikimodel-property' url='company'>\n" |
| 931 |
|
+ "<div class='wikimodel-property' url='name'><p>Cognium Systems</p>\n" |
| 932 |
|
+ "</div>\n" |
| 933 |
|
+ "<div class='wikimodel-property' url='addr'>\n" |
| 934 |
|
+ |
| 935 |
|
"<div class='wikimodel-property' url='country'><p><a href='France' class='wikimodel-freestanding'>France</a></p>\n" |
| 936 |
|
+ "</div>\n" |
| 937 |
|
+ |
| 938 |
|
"<div class='wikimodel-property' url='city'><p><a href='Paris' class='wikimodel-freestanding'>Paris</a></p>\n" |
| 939 |
|
+ "</div>\n" |
| 940 |
|
+ "<div class='wikimodel-property' url='street'><p>Cité Nollez</p>\n" |
| 941 |
|
+ "</div>\n" |
| 942 |
|
+ "<p> This is just a description...</p>\n" |
| 943 |
|
+ "</div>\n" |
| 944 |
|
+ "</div>\n" |
| 945 |
|
+ "<p>after</p>"); |
| 946 |
|
|
| 947 |
|
|
| 948 |
|
|
| 949 |
1 |
test( |
| 950 |
|
"before\n" |
| 951 |
|
+ "\n" |
| 952 |
|
+ "%company (((\n" |
| 953 |
|
+ " %name Cognium Systems\n" |
| 954 |
|
+ " %addr (((\n" |
| 955 |
|
+ " %country [France]\n" |
| 956 |
|
+ " %city Paris\n" |
| 957 |
|
+ " %street Cité Nollez\n" |
| 958 |
|
+ " This is just a description...\n" |
| 959 |
|
+ "after", |
| 960 |
|
"<p>before</p>\n" |
| 961 |
|
+ "<div class='wikimodel-property' url='company'>\n" |
| 962 |
|
+ "<div class='wikimodel-property' url='name'><p>Cognium Systems</p>\n" |
| 963 |
|
+ "</div>\n" |
| 964 |
|
+ "<div class='wikimodel-property' url='addr'>\n" |
| 965 |
|
+ |
| 966 |
|
"<div class='wikimodel-property' url='country'><p><a href='France' class='wikimodel-freestanding'>France</a></p>\n" |
| 967 |
|
+ "</div>\n" |
| 968 |
|
+ "<div class='wikimodel-property' url='city'><p>Paris</p>\n" |
| 969 |
|
+ "</div>\n" |
| 970 |
|
+ "<div class='wikimodel-property' url='street'><p>Cité Nollez</p>\n" |
| 971 |
|
+ "</div>\n" |
| 972 |
|
+ "<p> This is just a description...\n" |
| 973 |
|
+ "after</p>\n" |
| 974 |
|
+ "</div>\n" |
| 975 |
|
+ "</div>"); |
| 976 |
|
} |
| 977 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
| 978 |
1 |
public void testPropertiesInline() throws WikiParserException... |
| 979 |
|
{ |
| 980 |
1 |
test( |
| 981 |
|
"before %prop(value) after", |
| 982 |
|
"<p>before <span class='wikimodel-property' url='prop'>value</span> after</p>"); |
| 983 |
1 |
test( |
| 984 |
|
"before %foo:bar:toto.com/titi/tata?query=x#ancor(value) after", |
| 985 |
|
"<p>before <span class='wikimodel-property' url='foo:bar:toto.com/titi/tata?query=x#ancor'>value</span> after</p>"); |
| 986 |
1 |
test( |
| 987 |
|
"before %prop(before*bold*__italic__^^superscript^^~~subscript~~value) after", |
| 988 |
|
"<p>before <span class='wikimodel-property' url='prop'>before<strong>bold</strong><em>italic</em><sup>superscript</sup><sub>subscript</sub>value</span> after</p>"); |
| 989 |
|
} |
| 990 |
|
|
| 991 |
|
|
| 992 |
|
@throws |
| 993 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
| 994 |
1 |
public void testQuot() throws WikiParserException... |
| 995 |
|
{ |
| 996 |
1 |
test("Q: Quotation", "<blockquote>\n Quotation\n</blockquote>"); |
| 997 |
|
|
| 998 |
1 |
test(">This is a message\n" |
| 999 |
|
+ ">>and this is a response to the message \n" |
| 1000 |
|
+ "> This is a continuation of the same message", "" |
| 1001 |
|
+ "" |
| 1002 |
|
+ "<blockquote>\n" |
| 1003 |
|
+ "This is a message" |
| 1004 |
|
+ "<blockquote>\n" |
| 1005 |
|
+ "and this is a response to the message \n" |
| 1006 |
|
+ "</blockquote>\n" |
| 1007 |
|
+ "\n" |
| 1008 |
|
+ " This is a continuation of the same message\n" |
| 1009 |
|
+ "</blockquote>"); |
| 1010 |
|
|
| 1011 |
1 |
test("This is a paragraph\n" |
| 1012 |
|
+ ">and this is a quotations\n" |
| 1013 |
|
+ "> the second line", "<p>This is a paragraph</p>\n" |
| 1014 |
|
+ "<blockquote>\n" |
| 1015 |
|
+ "and this is a quotations\n" |
| 1016 |
|
+ " the second line\n" |
| 1017 |
|
+ "</blockquote>"); |
| 1018 |
|
|
| 1019 |
1 |
test(" This is just a description...\n" + " \n" + "\n" + "\n"); |
| 1020 |
1 |
test("> first\n" |
| 1021 |
|
+ ">> second\n" |
| 1022 |
|
+ ">> third\n" |
| 1023 |
|
+ ">>> subquot1\n" |
| 1024 |
|
+ ">>> subquot2\n" |
| 1025 |
|
+ ">> fourth"); |
| 1026 |
1 |
test("{{a='b'}}\n" |
| 1027 |
|
+ " first\n" |
| 1028 |
|
+ " second\n" |
| 1029 |
|
+ " third\n" |
| 1030 |
|
+ " subquot1\n" |
| 1031 |
|
+ " subquot2" |
| 1032 |
|
+ " fourth"); |
| 1033 |
|
} |
| 1034 |
|
|
| 1035 |
|
|
| 1036 |
|
@throws |
| 1037 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
| 1038 |
1 |
public void testReferences() throws WikiParserException... |
| 1039 |
|
{ |
| 1040 |
1 |
test( |
| 1041 |
|
"Это (=ссылка=) на внешний документ...", |
| 1042 |
|
"<p>Это <a href='ссылка' class='wikimodel-freestanding'>ссылка</a> на внешний документ...</p>"); |
| 1043 |
1 |
test( |
| 1044 |
|
"Это (=http://www.google.com ссылка=) на внешний документ...", |
| 1045 |
|
"<p>Это <a href='http://www.google.com'>ссылка</a> на внешний документ...</p>"); |
| 1046 |
1 |
test( |
| 1047 |
|
"This is a (=reference=) to an external document...", |
| 1048 |
|
"<p>This is a <a href='reference' class='wikimodel-freestanding'>reference</a> to an external document...</p>"); |
| 1049 |
1 |
test( |
| 1050 |
|
"This is a (=http://www.google.com reference=) to an external document...", |
| 1051 |
|
"<p>This is a <a href='http://www.google.com'>reference</a> to an external document...</p>"); |
| 1052 |
|
|
| 1053 |
1 |
test( |
| 1054 |
|
"before http://www.foo.bar/com after", |
| 1055 |
|
"<p>before <a href='http://www.foo.bar/com' class='wikimodel-freestanding'>http://www.foo.bar/com</a> after</p>"); |
| 1056 |
1 |
test( |
| 1057 |
|
"before http://www.foo.bar/com?q=abc#ancor after", |
| 1058 |
|
"<p>before <a href='http://www.foo.bar/com?q=abc#ancor' class='wikimodel-freestanding'>http://www.foo.bar/com?q=abc#ancor</a> after</p>"); |
| 1059 |
1 |
test( |
| 1060 |
|
"before wiki:Hello after", |
| 1061 |
|
"<p>before <a href='wiki:Hello' class='wikimodel-freestanding'>wiki:Hello</a> after</p>"); |
| 1062 |
1 |
test( |
| 1063 |
|
"before abc:cde#efg after", |
| 1064 |
|
"<p>before <a href='abc:cde#efg' class='wikimodel-freestanding'>abc:cde#efg</a> after</p>"); |
| 1065 |
|
|
| 1066 |
1 |
test( |
| 1067 |
|
"before first:second:third:anonymous@hello/path/?query=value#ancor after", |
| 1068 |
|
"<p>before <a href='first:second:third:anonymous@hello/path/?query=value#ancor' class='wikimodel-freestanding'>first:second:third:anonymous@hello/path/?query=value#ancor</a> after</p>"); |
| 1069 |
1 |
test( |
| 1070 |
|
"http://123.234.245.34/toto/titi/MyDoc.pdf", |
| 1071 |
|
"<p><a href='http://123.234.245.34/toto/titi/MyDoc.pdf' class='wikimodel-freestanding'>http://123.234.245.34/toto/titi/MyDoc.pdf</a></p>"); |
| 1072 |
|
|
| 1073 |
|
|
| 1074 |
1 |
test( |
| 1075 |
|
"before image:http://www.foo.com/bar.gif after", |
| 1076 |
|
"<p>before <img src='http://www.foo.com/bar.gif' class='wikimodel-freestanding'/> after</p>"); |
| 1077 |
1 |
test( |
| 1078 |
|
"before download:http://www.foo.com/bar.zip after", |
| 1079 |
|
"<p>before <a href='http://www.foo.com/bar.zip' class='wikimodel-freestanding'>http://www.foo.com/bar.zip</a> after</p>"); |
| 1080 |
1 |
test("download:MyDoc.pdf", "<p><a href='MyDoc.pdf' class='wikimodel-freestanding'>MyDoc.pdf</a></p>"); |
| 1081 |
1 |
test( |
| 1082 |
|
"Reference: download:MyDoc.pdf :not a reference", |
| 1083 |
|
"<p>Reference: <a href='MyDoc.pdf' class='wikimodel-freestanding'>MyDoc.pdf</a> :not a reference</p>"); |
| 1084 |
|
|
| 1085 |
|
|
| 1086 |
1 |
test( |
| 1087 |
|
"before wiki\\:Hello after", |
| 1088 |
|
"<p>before wiki<span class='wikimodel-escaped'>:</span>Hello after</p>"); |
| 1089 |
|
|
| 1090 |
|
|
| 1091 |
1 |
test("download::MyDoc.pdf", "<p>download::MyDoc.pdf</p>"); |
| 1092 |
1 |
test("before abc::after", "<p>before abc::after</p>"); |
| 1093 |
1 |
test("before abc: after", "<p>before abc: after</p>"); |
| 1094 |
1 |
test("before abc# after", "<p>before abc# after</p>"); |
| 1095 |
1 |
test("before abc:#cde after", "<p>before abc:#cde after</p>"); |
| 1096 |
|
|
| 1097 |
|
|
| 1098 |
1 |
test( |
| 1099 |
|
"before [toto] after", |
| 1100 |
|
"<p>before <a href='toto' class='wikimodel-freestanding'>toto</a> after</p>"); |
| 1101 |
1 |
test( |
| 1102 |
|
"before (=toto=) after", |
| 1103 |
|
"<p>before <a href='toto' class='wikimodel-freestanding'>toto</a> after</p>"); |
| 1104 |
1 |
test( |
| 1105 |
|
"before [#local ancor] after", |
| 1106 |
|
"<p>before <a href='#local'>ancor</a> after</p>"); |
| 1107 |
|
|
| 1108 |
1 |
test("before (((doc-before(=toto=)doc-after))) after", "" |
| 1109 |
|
+ "<p>before</p>\n" |
| 1110 |
|
+ "<div class='wikimodel-document'>\n" |
| 1111 |
|
+ "<p>doc-before<a href='toto' class='wikimodel-freestanding'>toto</a>doc-after</p>\n" |
| 1112 |
|
+ "</div>\n" |
| 1113 |
|
+ "<p>after</p>"); |
| 1114 |
1 |
test("before ((((=toto=)))) after", "" |
| 1115 |
|
+ "<p>before</p>\n" |
| 1116 |
|
+ "<div class='wikimodel-document'>\n" |
| 1117 |
|
+ "<p><a href='toto' class='wikimodel-freestanding'>toto</a></p>\n" |
| 1118 |
|
+ "</div>\n" |
| 1119 |
|
+ "<p>after</p>"); |
| 1120 |
1 |
test(" ((((=toto=))))", "" |
| 1121 |
|
+ "<div class='wikimodel-document'>\n" |
| 1122 |
|
+ "<p><a href='toto' class='wikimodel-freestanding'>toto</a></p>\n" |
| 1123 |
|
+ "</div>"); |
| 1124 |
1 |
test("((((=toto=))))", "" |
| 1125 |
|
+ "<div class='wikimodel-document'>\n" |
| 1126 |
|
+ "<p><a href='toto' class='wikimodel-freestanding'>toto</a></p>\n" |
| 1127 |
|
+ "</div>"); |
| 1128 |
|
|
| 1129 |
1 |
test("((((((toto))))))", "" |
| 1130 |
|
+ "<div class='wikimodel-document'>\n" |
| 1131 |
|
+ "<div class='wikimodel-document'>\n" |
| 1132 |
|
+ "<p>toto</p>\n" |
| 1133 |
|
+ "</div>\n" |
| 1134 |
|
+ "</div>"); |
| 1135 |
1 |
test("(((a(((toto)))b)))", "" |
| 1136 |
|
+ "<div class='wikimodel-document'>\n" |
| 1137 |
|
+ "<p>a</p>\n" |
| 1138 |
|
+ "<div class='wikimodel-document'>\n" |
| 1139 |
|
+ "<p>toto</p>\n" |
| 1140 |
|
+ "</div>\n" |
| 1141 |
|
+ "<p>b</p>\n" |
| 1142 |
|
+ "</div>"); |
| 1143 |
|
} |
| 1144 |
|
|
| 1145 |
|
|
| 1146 |
|
@throws |
| 1147 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 1148 |
1 |
public void testSpecialSymbols() throws WikiParserException... |
| 1149 |
|
{ |
| 1150 |
1 |
test(":)"); |
| 1151 |
|
} |
| 1152 |
|
|
| 1153 |
|
|
| 1154 |
|
@throws |
| 1155 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (27) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
| 1156 |
1 |
public void testTables() throws WikiParserException... |
| 1157 |
|
{ |
| 1158 |
|
|
| 1159 |
1 |
test("!! Header :: Cell ", "" |
| 1160 |
|
+ "<table><tbody>\n" |
| 1161 |
|
+ " <tr><th> Header </th><td> Cell </td></tr>\n" |
| 1162 |
|
+ "</tbody></table>"); |
| 1163 |
1 |
test("!! Header :: Cell ", "" |
| 1164 |
|
+ "<table><tbody>\n" |
| 1165 |
|
+ " <tr><th> Header </th><td> Cell </td></tr>\n" |
| 1166 |
|
+ "</tbody></table>"); |
| 1167 |
1 |
test("!! Header 1.1 !! Header 1.2\n" |
| 1168 |
|
+ ":: Cell 2.1 :: Cell 2.2\n" |
| 1169 |
|
+ ":: Cell 3.1 !! Head 3.2", "" |
| 1170 |
|
+ "<table><tbody>\n" |
| 1171 |
|
+ " <tr><th> Header 1.1 </th><th> Header 1.2</th></tr>\n" |
| 1172 |
|
+ " <tr><td> Cell 2.1 </td><td> Cell 2.2</td></tr>\n" |
| 1173 |
|
+ " <tr><td> Cell 3.1 </td><th> Head 3.2</th></tr>\n" |
| 1174 |
|
+ "</tbody></table>"); |
| 1175 |
|
|
| 1176 |
1 |
test("::Cell 1 :: Cell 2", "<table><tbody>\n" |
| 1177 |
|
+ " <tr><td>Cell 1 </td><td> Cell 2</td></tr>\n" |
| 1178 |
|
+ "</tbody></table>"); |
| 1179 |
1 |
test("Not a Header :: Not a Cell", "<p>Not a Header :: Not a Cell</p>"); |
| 1180 |
1 |
test("Not a Header::Not a Cell", "<p>Not a Header::Not a Cell</p>"); |
| 1181 |
|
|
| 1182 |
|
|
| 1183 |
1 |
test("|= Header 1.1 |= Header 1.2\n" |
| 1184 |
|
+ "| Cell 2.1 | Cell 2.2\n" |
| 1185 |
|
+ "| Cell 3.1 |= Head 3.2", "" |
| 1186 |
|
+ "<table><tbody>\n" |
| 1187 |
|
+ " <tr><th> Header 1.1 </th><th> Header 1.2</th></tr>\n" |
| 1188 |
|
+ " <tr><td> Cell 2.1 </td><td> Cell 2.2</td></tr>\n" |
| 1189 |
|
+ " <tr><td> Cell 3.1 </td><th> Head 3.2</th></tr>\n" |
| 1190 |
|
+ "</tbody></table>"); |
| 1191 |
1 |
test("|={{a=b}} Header 1.1 |= Header 1.2\n" |
| 1192 |
|
+ "| Cell 2.1 | Cell 2.2\n" |
| 1193 |
|
+ "| Cell 3.1 |={{c=d}} Head 3.2", "" |
| 1194 |
|
+ "<table><tbody>\n" |
| 1195 |
|
+ " <tr><th a='b'> Header 1.1 </th><th> Header 1.2</th></tr>\n" |
| 1196 |
|
+ " <tr><td> Cell 2.1 </td><td> Cell 2.2</td></tr>\n" |
| 1197 |
|
+ " <tr><td> Cell 3.1 </td><th c='d'> Head 3.2</th></tr>\n" |
| 1198 |
|
+ "</tbody></table>"); |
| 1199 |
1 |
test( |
| 1200 |
|
"{{x=y}}|={{a=b}} Header 1.1 |={{n=m}} Header 1.2", |
| 1201 |
|
"" |
| 1202 |
|
+ "<table><tbody>\n" |
| 1203 |
|
+ " <tr x='y'><th a='b'> Header 1.1 </th><th n='m'> Header 1.2</th></tr>\n" |
| 1204 |
|
+ "</tbody></table>"); |
| 1205 |
1 |
test( |
| 1206 |
|
"{{A=B}}\n{{x=y}}|={{a=b}} Header 1.1 |={{n=m}} Header 1.2", |
| 1207 |
|
"" |
| 1208 |
|
+ "<table A='B'><tbody>\n" |
| 1209 |
|
+ " <tr x='y'><th a='b'> Header 1.1 </th><th n='m'> Header 1.2</th></tr>\n" |
| 1210 |
|
+ "</tbody></table>"); |
| 1211 |
|
|
| 1212 |
|
|
| 1213 |
1 |
test("|| Header | Cell ", "" |
| 1214 |
|
+ "<table><tbody>\n" |
| 1215 |
|
+ " <tr><th> Header </th><td> Cell </td></tr>\n" |
| 1216 |
|
+ "</tbody></table>"); |
| 1217 |
1 |
test("|| Header | Cell ", "" |
| 1218 |
|
+ "<table><tbody>\n" |
| 1219 |
|
+ " <tr><th> Header </th><td> Cell </td></tr>\n" |
| 1220 |
|
+ "</tbody></table>"); |
| 1221 |
|
|
| 1222 |
1 |
test("|| cell 1.1 || cell 1.2\n" + "|| cell 2.1|| cell 2.2", "" |
| 1223 |
|
+ "<table><tbody>\n" |
| 1224 |
|
+ " <tr><th> cell 1.1 </th><th> cell 1.2</th></tr>\n" |
| 1225 |
|
+ " <tr><th> cell 2.1</th><th> cell 2.2</th></tr>\n" |
| 1226 |
|
+ "</tbody></table>"); |
| 1227 |
1 |
test("|| Head 1.1 || Head 1.2\n" + "| cell 2.1| cell 2.2", "" |
| 1228 |
|
+ "<table><tbody>\n" |
| 1229 |
|
+ " <tr><th> Head 1.1 </th><th> Head 1.2</th></tr>\n" |
| 1230 |
|
+ " <tr><td> cell 2.1</td><td> cell 2.2</td></tr>\n" |
| 1231 |
|
+ "</tbody></table>"); |
| 1232 |
1 |
test("|| Multi \nline \nheader \n" |
| 1233 |
|
+ "| Multi\nline\ncell\n" |
| 1234 |
|
+ "\n" |
| 1235 |
|
+ "One,two,three", "" |
| 1236 |
|
+ "<table><tbody>\n" |
| 1237 |
|
+ " <tr><th> Multi \nline \nheader </th></tr>\n" |
| 1238 |
|
+ " <tr><td> Multi\nline\ncell</td></tr>\n" |
| 1239 |
|
+ "</tbody></table>\n" |
| 1240 |
|
+ "<p>One,two,three</p>"); |
| 1241 |
1 |
test("this is not || a table", "<p>this is not || a table</p>"); |
| 1242 |
1 |
test("this is not | a table", "<p>this is not | a table</p>"); |
| 1243 |
1 |
test( |
| 1244 |
|
"|| __Italic header__ || *Bold header*\n" |
| 1245 |
|
+ "| __Italic cell__ | *Bold cell*\n", |
| 1246 |
|
"" |
| 1247 |
|
+ "<table><tbody>\n" |
| 1248 |
|
+ " <tr><th> <em>Italic header</em> </th><th> <strong>Bold header</strong></th></tr>\n" |
| 1249 |
|
+ " <tr><td> <em>Italic cell</em> </td><td> <strong>Bold cell</strong></td></tr>\n" |
| 1250 |
|
+ "</tbody></table>"); |
| 1251 |
1 |
test( |
| 1252 |
|
"|| __Italic header || *Bold header \n" |
| 1253 |
|
+ "| __Italic cell | *Bold cell \n", |
| 1254 |
|
"" |
| 1255 |
|
+ "<table><tbody>\n" |
| 1256 |
|
+ " <tr><th> <em>Italic header </em></th><th> <strong>Bold header </strong></th></tr>\n" |
| 1257 |
|
+ " <tr><td> <em>Italic cell </em></td><td> <strong>Bold cell </strong></td></tr>\n" |
| 1258 |
|
+ "</tbody></table>"); |
| 1259 |
|
|
| 1260 |
|
|
| 1261 |
1 |
test("{{a=b}}\n|| Header ", "" |
| 1262 |
|
+ "<table a='b'><tbody>\n" |
| 1263 |
|
+ " <tr><th> Header </th></tr>\n" |
| 1264 |
|
+ "</tbody></table>"); |
| 1265 |
1 |
test("{{a=b}}\n!! Header ", "" |
| 1266 |
|
+ "<table a='b'><tbody>\n" |
| 1267 |
|
+ " <tr><th> Header </th></tr>\n" |
| 1268 |
|
+ "</tbody></table>"); |
| 1269 |
1 |
test("{{a=b}}\n| cell ", "" |
| 1270 |
|
+ "<table a='b'><tbody>\n" |
| 1271 |
|
+ " <tr><td> cell </td></tr>\n" |
| 1272 |
|
+ "</tbody></table>"); |
| 1273 |
1 |
test("{{a=b}}\n:: cell ", "" |
| 1274 |
|
+ "<table a='b'><tbody>\n" |
| 1275 |
|
+ " <tr><td> cell </td></tr>\n" |
| 1276 |
|
+ "</tbody></table>"); |
| 1277 |
|
|
| 1278 |
|
|
| 1279 |
1 |
test("{{a=b}}||cell"); |
| 1280 |
1 |
test("{{a=b}}::cell1\n{{c=d}}::cell2"); |
| 1281 |
|
|
| 1282 |
1 |
test("{{a=b}}\n{{c=d}}||{{e=f}} cell"); |
| 1283 |
1 |
test("{{a=b}}\n{{c=d}}::{{e=f}} cell ::{{g=h}}"); |
| 1284 |
|
} |
| 1285 |
|
|
| 1286 |
|
|
| 1287 |
|
@throws |
| 1288 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
| 1289 |
1 |
public void testVerbatimeBlocks() throws WikiParserException... |
| 1290 |
|
{ |
| 1291 |
1 |
test("{{{verbatim}}}", "<pre>verbatim</pre>"); |
| 1292 |
1 |
test("{{{ver\\}}}batim}}}", "<pre>ver}}}batim</pre>"); |
| 1293 |
1 |
test("{{{verbatim", "<pre>verbatim</pre>"); |
| 1294 |
1 |
test("{{{{{{verbatim", "<pre>{{{verbatim</pre>"); |
| 1295 |
1 |
test("{{{{{{verbatim}}}", "<pre>{{{verbatim</pre>"); |
| 1296 |
1 |
test("{{{{{{verbatim}}}}}}", "<pre>{{{verbatim}}}</pre>"); |
| 1297 |
1 |
test( |
| 1298 |
|
"{{{before{{{verbatim}}}after}}}", |
| 1299 |
|
"<pre>before{{{verbatim}}}after</pre>"); |
| 1300 |
|
|
| 1301 |
1 |
test( |
| 1302 |
|
"{{{before{{{123{{{verbatim}}}456}}}after}}}", |
| 1303 |
|
"<pre>before{{{123{{{verbatim}}}456}}}after</pre>"); |
| 1304 |
1 |
test( |
| 1305 |
|
"{{{verbatim}}}}}} - the three last symbols should be in a paragraph", |
| 1306 |
|
"<pre>verbatim</pre>\n" |
| 1307 |
|
+ "<p>}}} - the three last symbols should be in a paragraph</p>"); |
| 1308 |
|
|
| 1309 |
|
|
| 1310 |
1 |
test(" {{{abc}}}", "<p> <tt class=\"wikimodel-verbatim\">abc</tt></p>"); |
| 1311 |
1 |
test("before{{{abc}}}after", "<p>before<tt class=\"wikimodel-verbatim\">abc</tt>after</p>"); |
| 1312 |
1 |
test(" {{{{{{abc}}}}}}", "<p> <tt class=\"wikimodel-verbatim\">{{{abc}}}</tt></p>"); |
| 1313 |
|
|
| 1314 |
1 |
test(" {{{verbatim}}}", "<p> <tt class=\"wikimodel-verbatim\">verbatim</tt></p>"); |
| 1315 |
1 |
test(" {{{{{{verbatim}}}", "<p> <tt class=\"wikimodel-verbatim\">{{{verbatim</tt></p>"); |
| 1316 |
1 |
test(" {{{{{{verbatim}}}}}}", "<p> <tt class=\"wikimodel-verbatim\">{{{verbatim}}}</tt></p>"); |
| 1317 |
1 |
test( |
| 1318 |
|
"before{{{xxx{{{verbatim}}}after", |
| 1319 |
|
"<p>before<tt class=\"wikimodel-verbatim\">xxx{{{verbatim}}}after</tt></p>"); |
| 1320 |
1 |
test( |
| 1321 |
|
"before{{{verbatim}}}after", |
| 1322 |
|
"<p>before<tt class=\"wikimodel-verbatim\">verbatim</tt>after</p>"); |
| 1323 |
1 |
test( |
| 1324 |
|
"before{{{verbatim}}}}}}after", |
| 1325 |
|
"<p>before<tt class=\"wikimodel-verbatim\">verbatim</tt>}}}after</p>"); |
| 1326 |
|
|
| 1327 |
1 |
test(" `verbatim`", "<p> <tt class=\"wikimodel-verbatim\">verbatim</tt></p>"); |
| 1328 |
1 |
test(" `{{{verbatim`", "<p> <tt class=\"wikimodel-verbatim\">{{{verbatim</tt></p>"); |
| 1329 |
1 |
test(" `{{{verbatim}}}`", "<p> <tt class=\"wikimodel-verbatim\">{{{verbatim}}}</tt></p>"); |
| 1330 |
1 |
test("before`verbatim`after", "<p>before<tt class=\"wikimodel-verbatim\">verbatim</tt>after</p>"); |
| 1331 |
1 |
test( |
| 1332 |
|
"before`verbatim`}}}after", |
| 1333 |
|
"<p>before<tt class=\"wikimodel-verbatim\">verbatim</tt>}}}after</p>"); |
| 1334 |
|
|
| 1335 |
1 |
test( |
| 1336 |
|
"before`xxx{{{verbatim}}}after", |
| 1337 |
|
"<p>before`xxx<tt class=\"wikimodel-verbatim\">verbatim</tt>after</p>"); |
| 1338 |
|
|
| 1339 |
|
|
| 1340 |
1 |
test("!! Syntax !! Results\n" |
| 1341 |
|
+ ":: {{{\n" |
| 1342 |
|
+ "!! Header 1 !! Header 2\n" |
| 1343 |
|
+ ":: Cell 1 :: Cell 2\n" |
| 1344 |
|
+ "}}} :: (((\n" |
| 1345 |
|
+ "!! Header 1 !! Header 2\n" |
| 1346 |
|
+ ":: Cell 1 :: Cell 2\n" |
| 1347 |
|
+ ")))\n" |
| 1348 |
|
+ ":: {{{\n" |
| 1349 |
|
+ "|| Header 1 || Header 2\n" |
| 1350 |
|
+ "| Cell 1 | Cell 2\n" |
| 1351 |
|
+ "}}} :: (((\n" |
| 1352 |
|
+ "|| Header 1 || Header 2\n" |
| 1353 |
|
+ "| Cell 1 | Cell 2\n" |
| 1354 |
|
+ ")))\n" |
| 1355 |
|
+ ""); |
| 1356 |
|
} |
| 1357 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 1358 |
1 |
public void testVerbatimInlineElements() throws WikiParserException... |
| 1359 |
|
{ |
| 1360 |
1 |
test("`verbatim`", "<p><tt class=\"wikimodel-verbatim\">verbatim</tt></p>"); |
| 1361 |
1 |
test("before`verbatim`after", "<p>before<tt class=\"wikimodel-verbatim\">verbatim</tt>after</p>"); |
| 1362 |
|
|
| 1363 |
|
|
| 1364 |
1 |
test("`verbatim", "<p>`verbatim</p>"); |
| 1365 |
1 |
test("before`after", "<p>before`after</p>"); |
| 1366 |
1 |
test("before`after\nnext line", "<p>before`after\nnext line</p>"); |
| 1367 |
|
} |
| 1368 |
|
} |