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 java.io.StringReader; |
23 |
|
|
24 |
|
import org.xwiki.rendering.wikimodel.IWemListener; |
25 |
|
import org.xwiki.rendering.wikimodel.IWikiParser; |
26 |
|
import org.xwiki.rendering.wikimodel.IWikiPrinter; |
27 |
|
import org.xwiki.rendering.wikimodel.WikiParserException; |
28 |
|
import org.xwiki.rendering.wikimodel.xhtml.PrintListener; |
29 |
|
import org.xwiki.rendering.wikimodel.xwiki.xwiki20.XWikiParser; |
30 |
|
|
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (312) |
Complexity: 26 |
Complexity Density: 0.09 |
|
35 |
|
public class XWiki20ParserTest extends AbstractWikiParserTest |
36 |
|
{ |
37 |
|
|
38 |
|
@param |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
40 |
42 |
public XWiki20ParserTest(String name)... |
41 |
|
{ |
42 |
42 |
super(name); |
43 |
|
} |
44 |
|
|
45 |
|
|
46 |
|
@param |
47 |
|
@param |
48 |
|
@throws |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
50 |
4 |
protected void doCustomTest(String string, String control) throws WikiParserException... |
51 |
|
{ |
52 |
4 |
println("=================================================="); |
53 |
4 |
StringReader reader = new StringReader(string); |
54 |
4 |
IWikiParser parser = newWikiParser(); |
55 |
4 |
final StringBuffer buf = new StringBuffer(); |
56 |
|
|
57 |
4 |
IWikiPrinter printer = newPrinter(buf); |
58 |
4 |
IWemListener listener = new PrintListener(printer) |
59 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
8 |
@Override... |
61 |
|
public void onSpace(String str) |
62 |
|
{ |
63 |
8 |
print("[" + str + "]"); |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
66 |
12 |
@Override... |
67 |
|
public void onWord(String str) |
68 |
|
{ |
69 |
12 |
print("{" + str + "}"); |
70 |
|
} |
71 |
|
}; |
72 |
4 |
parser.parse(reader, listener); |
73 |
4 |
String test = buf.toString(); |
74 |
4 |
println(test); |
75 |
4 |
checkResults(control, test); |
76 |
|
} |
77 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
272 |
@Override... |
79 |
|
protected IWikiParser newWikiParser() |
80 |
|
{ |
81 |
272 |
return new XWikiParser(); |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
84 |
2 |
public void test() throws Exception... |
85 |
|
{ |
86 |
2 |
test("before **bold** after", "<p>before <strong>bold</strong> after</p>"); |
87 |
|
|
88 |
2 |
doCustomTest("before **bold** after", "<p>{before}[ ]<strong>{bold}</strong>[ ]{after}</p>"); |
89 |
2 |
doCustomTest("before \n* bold after", "<p>{before}[ ]</p>\n" + "<ul>\n" + " <li>{bold}[ ]{after}</li>\n" |
90 |
|
+ "</ul>" + ""); |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
@throws |
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
96 |
2 |
public void testDefinitionLists() throws WikiParserException... |
97 |
|
{ |
98 |
2 |
test("; term: definition", "<dl>\n <dt>term: definition</dt>\n</dl>"); |
99 |
2 |
test(";: just definition", "<dl>\n <dd>just definition</dd>\n</dl>"); |
100 |
2 |
test("; just term", "<dl>\n <dt>just term</dt>\n</dl>"); |
101 |
2 |
test(";: ", "<dl>\n <dd></dd>\n</dl>"); |
102 |
|
|
103 |
2 |
test(";not: definition", "<p>;not: definition</p>"); |
104 |
2 |
test("; this:is_not_a_term : it is an uri", "<dl>\n" + " <dt>this:is_not_a_term : it is an uri</dt>\n" |
105 |
|
+ "</dl>"); |
106 |
|
|
107 |
2 |
test("; term one\n: definition one\n" + "; term two\n: definition two\n" + "; term three\n: definition three", |
108 |
|
"<dl>\n" + " <dt>term one</dt>\n" + " <dd>definition one</dd>\n" + " <dt>term two</dt>\n" |
109 |
|
+ " <dd>definition two</dd>\n" + " <dt>term three</dt>\n" + " <dd>definition three</dd>\n" |
110 |
|
+ "</dl>"); |
111 |
|
|
112 |
2 |
test("; One,\ntwo,\nbucle my shoes...\n: " + "...Three\nfour,\nClose the door\n" |
113 |
|
+ "; Five,\nSix\n: Pick up\n sticks\n\ntam-tam, pam-pam...", "<dl>\n" + " <dt>One,\n" + "two,\n" |
114 |
|
+ "bucle my shoes...</dt>\n" + " <dd>...Three\n" + "four,\n" + "Close the door</dd>\n" |
115 |
|
+ " <dt>Five,\n" + "Six</dt>\n" + " <dd>Pick up\n" + " sticks</dd>\n" + "</dl>\n" |
116 |
|
+ "<p>tam-tam, pam-pam...</p>"); |
117 |
|
} |
118 |
|
|
119 |
|
|
120 |
|
@throws |
121 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
122 |
2 |
public void testDocuments() throws WikiParserException... |
123 |
|
{ |
124 |
2 |
test("before ((( inside ))) after ", "<p>before</p>\n" + "<div class='wikimodel-document'>\n" |
125 |
|
+ "<p>inside</p>\n" + "</div>\n" + "<p>after </p>"); |
126 |
2 |
test("before\n((( inside ))) after ", "<p>before</p>\n" + "<div class='wikimodel-document'>\n" |
127 |
|
+ "<p>inside</p>\n" + "</div>\n" + "<p>after </p>"); |
128 |
2 |
test("before inside ))) after ", "<p>before inside ))) after </p>"); |
129 |
2 |
test("before (((\ninside ))) after ", "<p>before</p>\n" + "<div class='wikimodel-document'>\n" |
130 |
|
+ "<p>inside</p>\n" + "</div>\n" + "<p>after </p>"); |
131 |
2 |
test("| Line One | First doc: (((\n inside ))) after \n" + "|Line Two | Second doc: (((lkjlj))) skdjg", |
132 |
|
"<table><tbody>\n" + " <tr><td> Line One </td><td> First doc:<div class='wikimodel-document'>\n" |
133 |
|
+ "<p> inside</p>\n" + "</div>\n" + "after </td></tr>\n" |
134 |
|
+ " <tr><td>Line Two </td><td> Second doc:<div class='wikimodel-document'>\n" + "<p>lkjlj</p>\n" |
135 |
|
+ "</div>\n" + "skdjg</td></tr>\n" + "</tbody></table>"); |
136 |
2 |
test("| This is a table: | (((* item one\n" + "* item two\n" + " * subitem 1\n" + " * subitem 2\n" |
137 |
|
+ "* item three))) ", "<table><tbody>\n" |
138 |
|
+ " <tr><td> This is a table: </td><td><div class='wikimodel-document'>\n" + "<ul>\n" |
139 |
|
+ " <li>item one</li>\n" + " <li>item two</li>\n" + " <li>subitem 1</li>\n" |
140 |
|
+ " <li>subitem 2</li>\n" + " <li>item three</li>\n" + "</ul>\n" + "</div>\n" + "</td></tr>\n" |
141 |
|
+ "</tbody></table>"); |
142 |
|
|
143 |
2 |
test("before ((( opened and not closed", "<p>before</p>\n" + "<div class='wikimodel-document'>\n" |
144 |
|
+ "<p>opened and not closed</p>\n" + "</div>"); |
145 |
2 |
test("before ((( one ((( two ((( three ", "<p>before</p>\n" + "<div class='wikimodel-document'>\n" |
146 |
|
+ "<p>one</p>\n" + "<div class='wikimodel-document'>\n" + "<p>two</p>\n" |
147 |
|
+ "<div class='wikimodel-document'>\n" + "<p>three </p>\n" + "</div>\n" + "</div>\n" + "</div>"); |
148 |
2 |
test("before\n(% param=\"value\" %)((( inside ))) after ", "<p>before</p>\n" |
149 |
|
+ "<div class='wikimodel-document' param='value'>\n" + "<p>inside</p>\n" + "</div>\n" + "<p>after </p>"); |
150 |
2 |
test("before\n|(% param=\"value\" %)((( inside ))) after ", "<p>before</p>\n" + "<table><tbody>\n" |
151 |
|
+ " <tr><td param='value'><div class='wikimodel-document'>\n" + "<p>inside</p>\n" + "</div>\n" |
152 |
|
+ "after </td></tr>\n" + "</tbody></table>"); |
153 |
2 |
test("before\n|(% param=\"value\" %)(% docparam=\"docvalue\" %)((( inside ))) after ", "<p>before</p>\n" |
154 |
|
+ "<table><tbody>\n" + " <tr><td param='value'><div class='wikimodel-document' docparam='docvalue'>\n" |
155 |
|
+ "<p>inside</p>\n" + "</div>\n" + "after </td></tr>\n" + "</tbody></table>"); |
156 |
|
|
157 |
2 |
test("(% param=\"value\" %)\n ((( inside ))) after ", "<div class='wikimodel-document' param='value'>\n" |
158 |
|
+ "<p>inside</p>\n" + "</div>\n" + "<p>after </p>"); |
159 |
2 |
test("(% param=value %)(((inside)))", "<div class='wikimodel-document' param='value'>\n" + "<p>inside</p>\n" |
160 |
|
+ "</div>"); |
161 |
|
|
162 |
2 |
test("((( {{macro}} hello world! {{/macro}} )))", "<div class='wikimodel-document'>\n" |
163 |
|
+ "<pre class='wikimodel-macro' macroName='macro'><![CDATA[ hello world! ]]></pre>\n" + "</div>"); |
164 |
2 |
test("((( {{{ hello world! }}} )))", "<div class='wikimodel-document'>\n" + "<pre> hello world! </pre>\n" |
165 |
|
+ "</div>"); |
166 |
2 |
test("((( {{macro/}} )))", "<div class='wikimodel-document'>\n" |
167 |
|
+ "<pre class='wikimodel-macro' macroName='macro'/>\n" + "</div>"); |
168 |
|
|
169 |
2 |
test("|(% param=\"value\" %)(% docparam=\"docvalue\" %)((( )))", "<table><tbody>\n" |
170 |
|
+ " <tr><td param='value'><div class='wikimodel-document' docparam='docvalue'>\n" + "</div>\n" |
171 |
|
+ "</td></tr>\n" + "</tbody></table>"); |
172 |
2 |
test("| |(% param=\"value\" %)(% docparam=\"docvalue\" %)((( )))", "<table><tbody>\n" |
173 |
|
+ " <tr><td> </td><td param='value'><div class='wikimodel-document' docparam='docvalue'>\n" |
174 |
|
+ "</div>\n" + "</td></tr>\n" + "</tbody></table>"); |
175 |
2 |
test("((({{macro/}}\n)))", "<div class='wikimodel-document'>\n" |
176 |
|
+ "<pre class='wikimodel-macro' macroName='macro'/>\n" + "</div>"); |
177 |
2 |
test("((({{macro/}})))", "<div class='wikimodel-document'>\n" |
178 |
|
+ "<pre class='wikimodel-macro' macroName='macro'/>\n" + "</div>"); |
179 |
2 |
test("((({{{verbatim}}}\n)))", "<div class='wikimodel-document'>\n" + "<pre>verbatim</pre>\n" + "</div>"); |
180 |
2 |
test("((({{{verbatim}}})))", "<div class='wikimodel-document'>\n<pre>verbatim</pre>\n</div>"); |
181 |
|
} |
182 |
|
|
183 |
|
|
184 |
|
@throws |
185 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
186 |
2 |
public void testEscape() throws WikiParserException... |
187 |
|
{ |
188 |
2 |
test("~First letter is escaped", "<p>First letter is escaped</p>"); |
189 |
2 |
test("~ A space just after a tilda the tilda should desapear", |
190 |
|
"<p> A space just after a tilda the tilda should desapear</p>"); |
191 |
2 |
test("~~escaped tilda", "<p>~escaped tilda</p>"); |
192 |
2 |
test("tilda at the end~", "<p>tilda at the end</p>"); |
193 |
|
} |
194 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
195 |
2 |
public void testFormat() throws Exception... |
196 |
|
{ |
197 |
|
|
198 |
2 |
test("before **bold** after", "<p>before <strong>bold</strong> after</p>"); |
199 |
2 |
test("before //italic// after", "<p>before <em>italic</em> after</p>"); |
200 |
2 |
test("before --strike-- after", "<p>before <strike>strike</strike> after</p>"); |
201 |
2 |
test("before __underline__ after", "<p>before <ins>underline</ins> after</p>"); |
202 |
2 |
test("before ^^sup^^ after", "<p>before <sup>sup</sup> after</p>"); |
203 |
2 |
test("before ,,sub,, after", "<p>before <sub>sub</sub> after</p>"); |
204 |
2 |
test("before ##mono## after", "<p>before <mono>mono</mono> after</p>"); |
205 |
|
} |
206 |
|
|
207 |
|
|
208 |
|
@throws |
209 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
1PASS
|
|
210 |
2 |
public void testFormats() throws WikiParserException... |
211 |
|
{ |
212 |
2 |
test("(% param1='value1' param2='value2' %)"); |
213 |
2 |
test("xxx (% param1='value1' param2='value2' %) xxx "); |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
2 |
test("**bold**", "<p><strong>bold</strong></p>"); |
219 |
2 |
test("//italic//", "<p><em>italic</em></p>"); |
220 |
2 |
test("--strike--", "<p><strike>strike</strike></p>"); |
221 |
2 |
test("^^sup^^", "<p><sup>sup</sup></p>"); |
222 |
2 |
test(",,sub,,", "<p><sub>sub</sub></p>"); |
223 |
2 |
test("##mono##", "<p><mono>mono</mono></p>"); |
224 |
|
} |
225 |
|
|
226 |
|
|
227 |
|
@throws |
228 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
229 |
2 |
public void testHeaders() throws WikiParserException... |
230 |
|
{ |
231 |
2 |
test("= Heading 1", "<h1>Heading 1</h1>"); |
232 |
2 |
test("== Heading 2", "<h2>Heading 2</h2>"); |
233 |
2 |
test("=== Heading 3", "<h3>Heading 3</h3>"); |
234 |
2 |
test("==== Heading 4", "<h4>Heading 4</h4>"); |
235 |
2 |
test("===== Heading 5", "<h5>Heading 5</h5>"); |
236 |
2 |
test("====== Heading 6", "<h6>Heading 6</h6>"); |
237 |
2 |
test("= Heading 1 =some", "<h1>Heading 1</h1>\n<p>some</p>"); |
238 |
2 |
test("= Heading\n1 =", "<h1>Heading\n1</h1>"); |
239 |
2 |
test("= Heading 1 =\nsome text", "<h1>Heading 1</h1>\n<p>some text</p>"); |
240 |
2 |
test("= Heading 1 = \nsome text", "<h1>Heading 1</h1>\n<p> \nsome text</p>"); |
241 |
2 |
test("= Heading 1 =\n\n\n= Heading 1 =", "<h1>Heading 1</h1>\n<h1>Heading 1</h1>"); |
242 |
2 |
test("= Heading 1 {{macro}}{{/macro}}=", |
243 |
|
"<h1>Heading 1 <span class='wikimodel-macro' macroName='macro'><![CDATA[]]></span></h1>"); |
244 |
2 |
test("= Title level 1\n== Title level 2", "<h1>Title level 1</h1>\n<h2>Title level 2</h2>"); |
245 |
2 |
test("= Title level 1\n\n== Title level 2", "<h1>Title level 1</h1>\n<h2>Title level 2</h2>"); |
246 |
2 |
test("=== Heading 3===\ntext1\n\ntext2", "<h3>Heading 3</h3>\n<p>text1</p>\n<p>text2</p>"); |
247 |
2 |
test("= Heading 1 =\n= Heading 2 =", "<h1>Heading 1</h1>\n<h1>Heading 2</h1>"); |
248 |
2 |
test("= Heading 1\n\n= Heading 2 =", "<h1>Heading 1</h1>\n<h1>Heading 2</h1>"); |
249 |
2 |
test("= Heading 1 ={{macro/}}", "<h1>Heading 1</h1>\n<pre class='wikimodel-macro' macroName='macro'/>"); |
250 |
2 |
test("= Heading 1 =\n{{macro/}}", "<h1>Heading 1</h1>\n<pre class='wikimodel-macro' macroName='macro'/>"); |
251 |
2 |
test("=\n\nnot header", "<h1></h1>\n<p>not header</p>"); |
252 |
|
|
253 |
2 |
test("= Header = \nParagraph\n\n", "<h1>Header</h1>\n<p> \nParagraph</p>"); |
254 |
|
|
255 |
2 |
test("paragraph\n\n= header =", "<p>paragraph</p>\n<h1>header</h1>"); |
256 |
|
|
257 |
2 |
test("= {{macro/}}text =", "<h1><span class='wikimodel-macro' macroName='macro'/>text</h1>"); |
258 |
2 |
test("= {{macro/}} text =", "<h1><span class='wikimodel-macro' macroName='macro'/> text</h1>"); |
259 |
2 |
test("= {{macro/}}\ntext =", "<h1><span class='wikimodel-macro' macroName='macro'/>\ntext</h1>"); |
260 |
|
|
261 |
2 |
test("= header\n* list\n \n\n", "<h1>header</h1>\n<ul>\n <li>list\n </li>\n</ul>"); |
262 |
2 |
test("= header\n>quote\n \n\n", "<h1>header</h1>\n<blockquote>\nquote\n</blockquote>\n<p> </p>"); |
263 |
2 |
test("= header\n; term: definition\n \n\n", "<h1>header</h1>\n<dl>\n <dt>term: definition\n </dt>\n</dl>"); |
264 |
|
|
265 |
2 |
test("(% param='vale' %)\n= header =", "<h1 param='vale'>header</h1>"); |
266 |
|
} |
267 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
268 |
2 |
public void testImages() throws WikiParserException... |
269 |
|
{ |
270 |
2 |
test("image:reference", "<p><img src='reference' class='wikimodel-freestanding'/></p>"); |
271 |
2 |
test("image:reference ", "<p><img src='reference' class='wikimodel-freestanding'/> </p>"); |
272 |
2 |
test("image:reference~ ", "<p><img src='reference~ ' class='wikimodel-freestanding'/></p>"); |
273 |
2 |
test("image:wiki:space.page", "<p><img src='wiki:space.page' class='wikimodel-freestanding'/></p>"); |
274 |
2 |
test("image:wiki:space.page@file.ext", |
275 |
|
"<p><img src='wiki:space.page@file.ext' class='wikimodel-freestanding'/></p>"); |
276 |
2 |
test("[[image:reference]]", "<p><img src='reference'/></p>"); |
277 |
|
} |
278 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
279 |
2 |
public void testAttach() throws WikiParserException... |
280 |
|
{ |
281 |
2 |
test("attach:reference", |
282 |
|
"<p><a href='attach:reference' class='wikimodel-freestanding'>attach:reference</a></p>"); |
283 |
2 |
test("attach:wiki:space.page", |
284 |
|
"<p><a href='attach:wiki:space.page' class='wikimodel-freestanding'>attach:wiki:space.page</a></p>"); |
285 |
2 |
test("attach:wiki:space.page@file.ext", |
286 |
|
"<p><a href='attach:wiki:space.page@file.ext' class='wikimodel-freestanding'>attach:wiki:space.page@file.ext</a></p>"); |
287 |
|
} |
288 |
|
|
289 |
|
|
290 |
|
@throws |
291 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
292 |
2 |
public void testHorLine() throws WikiParserException... |
293 |
|
{ |
294 |
2 |
test("----"); |
295 |
2 |
test("-------"); |
296 |
2 |
test("-----------"); |
297 |
2 |
test(" -----------"); |
298 |
2 |
test("----abc"); |
299 |
2 |
test("(%a=b%)\n----", "<hr a='b' />"); |
300 |
|
} |
301 |
|
|
302 |
|
|
303 |
|
@throws |
304 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
305 |
2 |
public void testLineBreak() throws WikiParserException... |
306 |
|
{ |
307 |
2 |
test("abc\\\\def"); |
308 |
|
} |
309 |
|
|
310 |
|
|
311 |
|
@throws |
312 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
313 |
2 |
public void testLists() throws WikiParserException... |
314 |
|
{ |
315 |
2 |
test("* first", "<ul>\n" + " <li>first</li>\n" + "</ul>"); |
316 |
2 |
test("** second", "<ul>\n" + " <li><ul>\n" + " <li>second</li>\n" + "</ul>\n" + "</li>\n" + "</ul>"); |
317 |
2 |
test(" ** second", "<ul>\n" + " <li><ul>\n" + " <li>second</li>\n" + "</ul>\n" + "</li>\n" + "</ul>"); |
318 |
2 |
test("* first\n** second", "<ul>\n" + " <li>first<ul>\n" + " <li>second</li>\n" + "</ul>\n" + "</li>\n" |
319 |
|
+ "</ul>"); |
320 |
2 |
test("*1. second", "<ul>\n" + " <li><ol>\n" + " <li>second</li>\n" + "</ol>\n" + "</li>\n" + "</ul>"); |
321 |
2 |
test(" 11. second", "<ol>\n" + " <li><ol>\n" + " <li>second</li>\n" + "</ol>\n" + "</li>\n" + "</ol>"); |
322 |
|
|
323 |
2 |
test("* item one\n" + "* item two\n" + "*1. item three\n" + "*1. item four\n" + "* item five - first line\n" |
324 |
|
+ " item five - second line\n" + "* item six\n" + " is on multiple\n" + " lines", "<ul>\n" |
325 |
|
+ " <li>item one</li>\n" + " <li>item two<ol>\n" + " <li>item three</li>\n" |
326 |
|
+ " <li>item four</li>\n" + "</ol>\n" + "</li>\n" + " <li>item five - first line\n" |
327 |
|
+ " item five - second line</li>\n" + " <li>item six\n" + " is on multiple\n" + " lines</li>\n" |
328 |
|
+ "</ul>"); |
329 |
|
|
330 |
2 |
test("* item one", "<ul>\n <li>item one</li>\n</ul>"); |
331 |
2 |
test("*item one", "<p>*item one</p>"); |
332 |
2 |
test("(%param=\"value\"%)\n* item one\n" + "** item two", "<ul param='value'>\n" + " <li>item one<ul>\n" |
333 |
|
+ " <li>item two</li>\n" + "</ul>\n" + "</li>\n" + "</ul>"); |
334 |
2 |
test("(%param=\"value\"%)\n* item one\n" + "(%param2=\"value2\"%)\n** item two", "<ul param='value'>\n" |
335 |
|
+ " <li>item one<ul param2='value2'>\n" + " <li>item two</li>\n" + "</ul>\n" + "</li>\n" + "</ul>"); |
336 |
2 |
test("(%param=\"value\"%)\n* item one\n" + "(%param2=\"value2\"%)\n** item two" |
337 |
|
+ "(%param3=\"value3\"%)\n** item three", "<ul param='value'>\n" |
338 |
|
+ " <li>item one<ul param2='value2'>\n" + " <li>item two</li>\n" + " <li>item three</li>\n" |
339 |
|
+ "</ul>\n" + "</li>\n" + "</ul>"); |
340 |
|
|
341 |
2 |
test("* \n((( group )))", "<ul>\n" + " <li>\n" + "<div class='wikimodel-document'>\n" + "<p>group</p>\n" |
342 |
|
+ "</div>\n" + "</li>\n" + "</ul>"); |
343 |
|
|
344 |
2 |
test("* \n((( group ))) not group\n* item", "<ul>\n" + " <li>\n" + "<div class='wikimodel-document'>\n" |
345 |
|
+ "<p>group</p>\n" + "</div>\n" + "not group</li>\n" + " <li>item</li>\n" + "</ul>"); |
346 |
2 |
test("* \n((( group )))\n* item", "<ul>\n" + " <li>\n" + "<div class='wikimodel-document'>\n" |
347 |
|
+ "<p>group</p>\n" + "</div>\n" + "</li>\n" + " <li>item</li>\n" + "</ul>"); |
348 |
|
} |
349 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (57) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
350 |
2 |
public void testMacro() throws WikiParserException... |
351 |
|
{ |
352 |
|
|
353 |
2 |
test("{{macro/}}{{macro/}}", |
354 |
|
"<p><span class='wikimodel-macro' macroName='macro'/><span class='wikimodel-macro' macroName='macro'/></p>"); |
355 |
|
|
356 |
2 |
test("{{macro/}}\n{{macro/}}", "<p><span class='wikimodel-macro' macroName='macro'/>\n" |
357 |
|
+ "<span class='wikimodel-macro' macroName='macro'/></p>"); |
358 |
|
|
359 |
2 |
test("{{macro/}}\ntext", "<p><span class='wikimodel-macro' macroName='macro'/>\n" + "text</p>"); |
360 |
|
|
361 |
2 |
test("{{macro/}}\n", "<pre class='wikimodel-macro' macroName='macro'/>"); |
362 |
|
|
363 |
2 |
test("{{macro/}}\n\n{{macro/}}", |
364 |
|
"<pre class='wikimodel-macro' macroName='macro'/>\n<pre class='wikimodel-macro' macroName='macro'/>"); |
365 |
|
|
366 |
2 |
test("{{macro/}}\n\n{{macro/}}\n\n{{macro/}}", "<pre class='wikimodel-macro' macroName='macro'/>\n" |
367 |
|
+ "<pre class='wikimodel-macro' macroName='macro'/>\n" |
368 |
|
+ "<pre class='wikimodel-macro' macroName='macro'/>"); |
369 |
|
|
370 |
2 |
test("{{macro/}}\n\n{{macro/}}\n\n{{macro/}}\n\n{{macro/}}", |
371 |
|
"<pre class='wikimodel-macro' macroName='macro'/>\n" + "<pre class='wikimodel-macro' macroName='macro'/>\n" |
372 |
|
+ "<pre class='wikimodel-macro' macroName='macro'/>\n" |
373 |
|
+ "<pre class='wikimodel-macro' macroName='macro'/>"); |
374 |
|
|
375 |
2 |
test("some text {{macro/}}\n\n{{macro/}}", |
376 |
|
"<p>some text <span class='wikimodel-macro' macroName='macro'/></p>\n<pre class='wikimodel-macro' macroName='macro'/>"); |
377 |
|
|
378 |
2 |
test( |
379 |
|
"{{toto1}}a{{/toto1}}{{toto2/}}", |
380 |
|
"<p><span class='wikimodel-macro' macroName='toto1'><![CDATA[a]]></span><span class='wikimodel-macro' macroName='toto2'/></p>"); |
381 |
|
|
382 |
2 |
test( |
383 |
|
"{{toto}}a{{/toto}}{{toto}}{{/toto}}", |
384 |
|
"<p><span class='wikimodel-macro' macroName='toto'><![CDATA[a]]></span><span class='wikimodel-macro' macroName='toto'><![CDATA[]]></span></p>"); |
385 |
|
|
386 |
2 |
test("{{toto}}a{{/toto}}", "<pre class='wikimodel-macro' macroName='toto'><![CDATA[a]]></pre>"); |
387 |
|
|
388 |
2 |
test("{{x:toto y:param=value1 z:param2='value two'}}a{{/x:toto}}", |
389 |
|
"<pre class='wikimodel-macro' macroName='x:toto' y:param='value1' z:param2='value two'><![CDATA[a]]></pre>"); |
390 |
|
|
391 |
2 |
test("{{toto}}a{{toto}}b{{/toto}}c{{/toto}}", |
392 |
|
"<pre class='wikimodel-macro' macroName='toto'><![CDATA[a{{toto}}b{{/toto}}c]]></pre>"); |
393 |
|
|
394 |
2 |
test("{{macro}}{{macro1}}{{/macro1}}{{/macro}}", |
395 |
|
"<pre class='wikimodel-macro' macroName='macro'><![CDATA[{{macro1}}{{/macro1}}]]></pre>"); |
396 |
|
|
397 |
2 |
test("{{toto}}a{{tata}}b{{/tata}}c{{/toto}}", |
398 |
|
"<pre class='wikimodel-macro' macroName='toto'><![CDATA[a{{tata}}b{{/tata}}c]]></pre>"); |
399 |
|
|
400 |
2 |
test("before\n{{toto}}a{{/toto}}\nafter", |
401 |
|
"<p>before\n<span class='wikimodel-macro' macroName='toto'><![CDATA[a]]></span>\nafter</p>"); |
402 |
|
|
403 |
2 |
test("before\n{{toto}}a{{/toto}}after", |
404 |
|
"<p>before\n<span class='wikimodel-macro' macroName='toto'><![CDATA[a]]></span>after</p>"); |
405 |
|
|
406 |
|
|
407 |
2 |
test("{{x:toto}}a{{/x:toto}}", "<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[a]]></pre>"); |
408 |
2 |
test("{{x:toto}}a{{x:toto}}b{{/x:toto}}c{{/x:toto}}", |
409 |
|
"<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[a{{x:toto}}b{{/x:toto}}c]]></pre>"); |
410 |
2 |
test("{{x:toto}}a{{tata}}b{{/tata}}c{{/x:toto}}", |
411 |
|
"<pre class='wikimodel-macro' macroName='x:toto'><![CDATA[a{{tata}}b{{/tata}}c]]></pre>"); |
412 |
|
|
413 |
2 |
test("before\n{{x:toto}}a{{/x:toto}}\nafter", |
414 |
|
"<p>before\n<span class='wikimodel-macro' macroName='x:toto'><![CDATA[a]]></span>\nafter</p>"); |
415 |
|
|
416 |
2 |
test("before\n{{x:toto}}a{{/x:toto}}after", "<p>before\n" |
417 |
|
+ "<span class='wikimodel-macro' macroName='x:toto'><![CDATA[a]]></span>after</p>"); |
418 |
|
|
419 |
|
|
420 |
2 |
test("{{x:toto /}}", "<pre class='wikimodel-macro' macroName='x:toto'/>"); |
421 |
|
|
422 |
2 |
test("{{x:toto a=b c=d /}}", "<pre class='wikimodel-macro' macroName='x:toto' a='b' c='d'/>"); |
423 |
|
|
424 |
2 |
test("before\n{{x:toto a=b c=d/}}\nafter", |
425 |
|
"<p>before\n<span class='wikimodel-macro' macroName='x:toto' a='b' c='d'/>\nafter</p>"); |
426 |
|
|
427 |
2 |
test("before\n{{x:toto a='b' c='d'/}}after", "<p>before\n" |
428 |
|
+ "<span class='wikimodel-macro' macroName='x:toto' a='b' c='d'/>after</p>"); |
429 |
|
|
430 |
2 |
test("before{{x:toto /}}after", "<p>before<span class='wikimodel-macro' macroName='x:toto'/>after</p>"); |
431 |
|
|
432 |
2 |
test("**{{macro/}}** text", "<p><strong><span class='wikimodel-macro' macroName='macro'/></strong> text</p>"); |
433 |
|
|
434 |
|
|
435 |
2 |
test("{{toto}}", "<pre class='wikimodel-macro' macroName='toto'><![CDATA[]]></pre>"); |
436 |
2 |
test("{{toto}}a{{toto}}", "<pre class='wikimodel-macro' macroName='toto'><![CDATA[a{{toto}}]]></pre>"); |
437 |
2 |
test("{{/x}}", "<p>{{/x}}</p>"); |
438 |
2 |
test("before{{a}}x{{b}}y{{c}}z\n" + "new line in the same macro", |
439 |
|
|
440 |
|
"<p>before<span class='wikimodel-macro' macroName='a'><![CDATA[x{{b}}y{{c}}z\n" |
441 |
|
+ "new line in the same macro]]></span></p>"); |
442 |
|
|
443 |
2 |
test("before{{a}}x{{b}}y{{c}}z{{/a}}after", |
444 |
|
"<p>before<span class='wikimodel-macro' macroName='a'><![CDATA[x{{b}}y{{c}}z]]></span>after</p>"); |
445 |
|
|
446 |
|
|
447 |
2 |
test("{{toto}}a{{/toto}}", "<pre class='wikimodel-macro' macroName='toto'><![CDATA[a]]></pre>"); |
448 |
2 |
test("before{{toto}}macro{{/toto}}after", |
449 |
|
"<p>before<span class='wikimodel-macro' macroName='toto'><![CDATA[macro]]></span>after</p>"); |
450 |
|
|
451 |
2 |
test("before{{toto a=b c=d}}toto macro tata {{/toto}}after", |
452 |
|
"<p>before<span class='wikimodel-macro' macroName='toto' a='b' c='d'>" + "<![CDATA[toto macro tata ]]>" |
453 |
|
+ "</span>after</p>"); |
454 |
|
|
455 |
2 |
test("before{{toto a=b c=d}}toto {{x qsdk}} macro {{sd}} tata {{/toto}}after", |
456 |
|
"<p>before<span class='wikimodel-macro' macroName='toto' a='b' c='d'>" |
457 |
|
+ "<![CDATA[toto {{x qsdk}} macro {{sd}} tata ]]>" + "</span>after</p>"); |
458 |
|
|
459 |
|
|
460 |
2 |
test("{{macro}}\n{{/macro}}", "<pre class='wikimodel-macro' macroName='macro'><![CDATA[]]></pre>"); |
461 |
2 |
test("{{macro}}\r\n{{/macro}}", "<pre class='wikimodel-macro' macroName='macro'><![CDATA[]]></pre>"); |
462 |
2 |
test("{{macro}}\n\n{{/macro}}", "<pre class='wikimodel-macro' macroName='macro'><![CDATA[]]></pre>"); |
463 |
2 |
test("{{macro}}\r\n\r\n{{/macro}}", "<pre class='wikimodel-macro' macroName='macro'><![CDATA[]]></pre>"); |
464 |
2 |
test("{{macro}}\ncontent\n{{/macro}}", |
465 |
|
"<pre class='wikimodel-macro' macroName='macro'><![CDATA[content]]></pre>"); |
466 |
2 |
test("text {{macro}}\n{{/macro}} text", |
467 |
|
"<p>text <span class='wikimodel-macro' macroName='macro'><![CDATA[]]></span> text</p>"); |
468 |
2 |
test("text {{macro}}\n\n{{/macro}} text", |
469 |
|
"<p>text <span class='wikimodel-macro' macroName='macro'><![CDATA[]]></span> text</p>"); |
470 |
2 |
test("text {{macro}}\ncontent\n{{/macro}} text", |
471 |
|
"<p>text <span class='wikimodel-macro' macroName='macro'><![CDATA[content]]></span> text</p>"); |
472 |
|
|
473 |
|
|
474 |
2 |
test("{{ toto a=b c=d}}", "<p>{{ toto a=b c=d}}</p>"); |
475 |
|
|
476 |
2 |
test("This is a macro: {{toto x:a=b x:c=d}}\n" + "<table>\n" + "#foreach ($x in $table)\n" |
477 |
|
+ " <tr>hello, $x</tr>\n" + "#end\n" + "</table>\n" + "{{/toto}}", |
478 |
|
|
479 |
|
"<p>This is a macro: <span class='wikimodel-macro' macroName='toto' x:a='b' x:c='d'><![CDATA[" + "<table>\n" |
480 |
|
+ "#foreach ($x in $table)\n" + " <tr>hello, $x</tr>\n" + "#end\n" + "</table>" + "]]></span></p>"); |
481 |
|
|
482 |
2 |
test("* item one\n" + "* item two\n" + " {{code}} this is a code{{/code}} \n" |
483 |
|
+ " the same item (continuation)\n" + "* item three", |
484 |
|
|
485 |
|
"<ul>\n" + " <li>item one</li>\n" + " <li>item two\n" |
486 |
|
+ " <span class='wikimodel-macro' macroName='code'><![CDATA[ this is a code]]></span> \n" |
487 |
|
+ " the same item (continuation)</li>\n" + " <li>item three</li>\n" + "</ul>"); |
488 |
|
|
489 |
|
|
490 |
2 |
test("{{x:y a=b c=d}}", "<pre class='wikimodel-macro' macroName='x:y' a='b' c='d'><![CDATA[]]></pre>"); |
491 |
2 |
test("before{{x:y a=b c=d}}macro content", |
492 |
|
"<p>before<span class='wikimodel-macro' macroName='x:y' a='b' c='d'><![CDATA[macro content]]></span></p>"); |
493 |
2 |
test("before\n{{x:y a=b c=d}}macro content", "<p>before\n" |
494 |
|
+ "<span class='wikimodel-macro' macroName='x:y' a='b' c='d'><![CDATA[macro content]]></span></p>"); |
495 |
|
|
496 |
2 |
test("before\n{{x:y a=b c=d/}}\nafter", |
497 |
|
"<p>before\n<span class='wikimodel-macro' macroName='x:y' a='b' c='d'/>\nafter</p>"); |
498 |
|
|
499 |
|
|
500 |
2 |
test("a{{a}}{{b}}", "<p>a<span class='wikimodel-macro' macroName='a'><![CDATA[{{b}}]]></span></p>"); |
501 |
2 |
test("a{{a}}{{b}}{", "<p>a<span class='wikimodel-macro' macroName='a'><![CDATA[{{b}}{]]></span></p>"); |
502 |
|
|
503 |
|
|
504 |
2 |
test("{{toto param1=\"val~\"ue1\" param2=\"v~~al~}}ue2\"}}a{{/toto}}", |
505 |
|
"<pre class='wikimodel-macro' macroName='toto' param1='val"ue1' param2='v~al}}ue2'><![CDATA[a]]></pre>"); |
506 |
|
|
507 |
|
|
508 |
2 |
test("{{macro\n param1=\"val1\"\n param2=\"val2\"\n/}}", |
509 |
|
"<pre class='wikimodel-macro' macroName='macro' param1='val1' param2='val2'/>"); |
510 |
2 |
test("{{macro\n param1=\"val1\"\n param2=\"val2\"\n}}foo{{/macro}}", |
511 |
|
"<pre class='wikimodel-macro' macroName='macro' param1='val1' param2='val2'><![CDATA[foo]]></pre>"); |
512 |
|
} |
513 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
514 |
2 |
public void testMacroParameterEscaping() throws WikiParserException... |
515 |
|
{ |
516 |
2 |
test("{{macro a={{b /}} /}}", "<p><span class='wikimodel-macro' macroName='macro' a='{{b'/> /}}</p>"); |
517 |
|
|
518 |
2 |
test("{{macro a=\"{{b /}}\" /}}", "<pre class='wikimodel-macro' macroName='macro' a='{{b /}}'/>"); |
519 |
|
|
520 |
2 |
test("{{macro a='{{b /}}' /}}", "<pre class='wikimodel-macro' macroName='macro' a='{{b /}}'/>"); |
521 |
|
|
522 |
2 |
test("{{macro \"{{b /}}\"=a /}}", "<pre class='wikimodel-macro' macroName='macro'/>"); |
523 |
|
|
524 |
2 |
test("{{macro '{{b /}}'=a /}}", "<pre class='wikimodel-macro' macroName='macro'/>"); |
525 |
|
|
526 |
2 |
test("{{macro a={{b/~}} /}}", "<pre class='wikimodel-macro' macroName='macro' a='{{b/}}'/>"); |
527 |
|
|
528 |
2 |
test("{{macro a={{b/}~} /}}", "<pre class='wikimodel-macro' macroName='macro' a='{{b/}}'/>"); |
529 |
|
|
530 |
2 |
test("{{macro {{b/~}}=a /}}", "<pre class='wikimodel-macro' macroName='macro'/>"); |
531 |
|
|
532 |
2 |
test("{{macro a=\"{{b /~}}\" /}}", "<pre class='wikimodel-macro' macroName='macro' a='{{b /}}'/>"); |
533 |
|
|
534 |
2 |
test("{{macro a='{{b /~}}' /}}", "<pre class='wikimodel-macro' macroName='macro' a='{{b /}}'/>"); |
535 |
|
|
536 |
2 |
test("{{macro a='~'' /}}", "<pre class='wikimodel-macro' macroName='macro' a='''/>"); |
537 |
|
|
538 |
2 |
test("{{macro a=\"~\"\" /}}", "<pre class='wikimodel-macro' macroName='macro' a='"'/>"); |
539 |
|
|
540 |
2 |
test("{{macro a=\"foo\" b=\"bar\" }}content{{/macro}}\n\n{{macro a=\"foo\" b=\"bar\" }}content{{/macro}}", |
541 |
|
"<pre class='wikimodel-macro' macroName='macro' a='foo' b='bar'><![CDATA[content]]></pre>\n" |
542 |
|
+ "<pre class='wikimodel-macro' macroName='macro' a='foo' b='bar'><![CDATA[content]]></pre>" ); |
543 |
|
|
544 |
2 |
test("{{box title = \"1~\"2|-|3=~~~\"4~~\" }}=~\"|-|~~{{/box}}", "<pre class='wikimodel-macro' macroName='box' title='1"2|-|3=~"4~'><![CDATA[=~\"|-|~~]]></pre>"); |
545 |
|
} |
546 |
|
|
547 |
|
|
548 |
|
@throws |
549 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
550 |
2 |
public void testParagraphs() throws WikiParserException... |
551 |
|
{ |
552 |
2 |
test("First paragraph.\n" + "Second line of the same paragraph.\n" + "\n" + "The second paragraph"); |
553 |
2 |
test("(% a='b' %)\nparagraph1\n\nparagraph2", "<p a='b'>paragraph1</p>\n<p>paragraph2</p>"); |
554 |
|
|
555 |
2 |
test("(% param='value' %)\n{{macro}}content{{/macro}}inline", |
556 |
|
"<p param='value'><span class='wikimodel-macro' macroName='macro'><![CDATA[content]]></span>inline</p>"); |
557 |
|
|
558 |
2 |
test("(% param='value' %)\n", "<p param='value'></p>"); |
559 |
|
|
560 |
2 |
test("(% param='value' %)\n" + "{{macro}}content{{/macro}}\n\n" + "after", |
561 |
|
"<p param='value'><span class='wikimodel-macro' macroName='macro'><![CDATA[content]]></span></p>\n" |
562 |
|
+ "<p>after</p>"); |
563 |
|
|
564 |
2 |
test("(% param='value' %)\n\n", "<p param='value'></p>"); |
565 |
|
|
566 |
2 |
test("(% param='value' %)\n\na", "<p param='value'></p>\n<p>a</p>"); |
567 |
|
|
568 |
2 |
test("(% param='value' %)\n\n\n", "<p param='value'></p>\n<div style='height:2em;'></div>"); |
569 |
|
|
570 |
2 |
test("(% param='value' %)\ntext\n(% param2='value2' %)text", |
571 |
|
"<p param='value'>text\n<span class='wikimodel-parameters'[param2='value2']>text</span></p>"); |
572 |
|
|
573 |
|
|
574 |
2 |
test("toto\n(% param='value' %)\ntiti", "<p>toto</p>\n<p param='value'>titi</p>"); |
575 |
|
} |
576 |
|
|
577 |
|
|
578 |
|
@throws |
579 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
580 |
2 |
public void testQuot() throws WikiParserException... |
581 |
|
{ |
582 |
2 |
test(">line", "<blockquote>\nline\n</blockquote>"); |
583 |
2 |
test(">line1\n>line2", "<blockquote>\nline1\nline2\n</blockquote>"); |
584 |
2 |
test("This is a paragraph" + "\n" + "\n" + ">and this is a quotations\n" + ">the second line", |
585 |
|
"<p>This is a paragraph</p>\n" + "<blockquote>\n" + "and this is a quotations\n" + "the second line\n" |
586 |
|
+ "</blockquote>"); |
587 |
|
} |
588 |
|
|
589 |
|
|
590 |
|
@throws |
591 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
592 |
2 |
public void testReferences() throws WikiParserException... |
593 |
|
{ |
594 |
2 |
test("before [[xx[[image:img.gif]]yy]] after", |
595 |
|
"<p>before <a href='xx[[image:img.gif]]yy' class='wikimodel-freestanding'>xx[[image:img.gif]]yy</a> after</p>"); |
596 |
2 |
test("before [[xx[[image:img.gif bqdf]]yy]] after", |
597 |
|
"<p>before <a href='xx[[image:img.gif bqdf]]yy' class='wikimodel-freestanding'>xx[[image:img.gif bqdf]]yy</a> after</p>"); |
598 |
2 |
test("before http://www.foo.bar/com after", |
599 |
|
"<p>before <a href='http://www.foo.bar/com' class='wikimodel-freestanding'>http://www.foo.bar/com</a> after</p>"); |
600 |
2 |
test("before [[toto]] after", "<p>before <a href='toto' class='wikimodel-freestanding'>toto</a> after</p>"); |
601 |
2 |
test("before [[ [toto] [tata] ]] after", |
602 |
|
"<p>before <a href=' [toto] [tata] ' class='wikimodel-freestanding'> [toto] [tata] </a> after</p>"); |
603 |
2 |
test("before wiki:Hello after", "<p>before wiki:Hello after</p>"); |
604 |
2 |
test("before mailto:Hello after", |
605 |
|
"<p>before <a href='mailto:Hello' class='wikimodel-freestanding'>mailto:Hello</a> after</p>"); |
606 |
2 |
test("before wiki~:Hello after", "<p>before wiki:Hello after</p>"); |
607 |
|
|
608 |
|
|
609 |
2 |
test("before [toto] after", "<p>before [toto] after</p>"); |
610 |
2 |
test("not [[a reference] at all!", "<p>not [[a reference] at all!</p>"); |
611 |
2 |
test("before [#local ancor] after", "<p>before [#local ancor] after</p>"); |
612 |
|
} |
613 |
|
|
614 |
|
|
615 |
|
@throws |
616 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (31) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
617 |
2 |
public void testTables() throws WikiParserException... |
618 |
|
{ |
619 |
|
|
620 |
2 |
test("!= Header !! Cell ", "" + "<table><tbody>\n" + " <tr><th> Header </th><td> Cell </td></tr>\n" |
621 |
|
+ "</tbody></table>"); |
622 |
2 |
test("!= Header !! Cell ", "" + "<table><tbody>\n" |
623 |
|
+ " <tr><th> Header </th><td> Cell </td></tr>\n" + "</tbody></table>"); |
624 |
|
|
625 |
2 |
test("!!Cell 1 !! Cell 2", "<table><tbody>\n" + " <tr><td>Cell 1 </td><td> Cell 2</td></tr>\n" |
626 |
|
+ "</tbody></table>"); |
627 |
2 |
test("Not a Header !! Not a Cell", "<p>Not a Header !! Not a Cell</p>"); |
628 |
2 |
test("Not a Header!!Not a Cell", "<p>Not a Header!!Not a Cell</p>"); |
629 |
|
|
630 |
|
|
631 |
2 |
test("|= Header | Cell ", "" + "<table><tbody>\n" + " <tr><th> Header </th><td> Cell </td></tr>\n" |
632 |
|
+ "</tbody></table>"); |
633 |
2 |
test("|= Header | Cell ", "" + "<table><tbody>\n" |
634 |
|
+ " <tr><th> Header </th><td> Cell </td></tr>\n" + "</tbody></table>"); |
635 |
|
|
636 |
2 |
test("|Cell 1 | Cell 2", "<table><tbody>\n" + " <tr><td>Cell 1 </td><td> Cell 2</td></tr>\n" |
637 |
|
+ "</tbody></table>"); |
638 |
2 |
test("Not a Header | Not a Cell", "<p>Not a Header | Not a Cell</p>"); |
639 |
2 |
test("Not a Header|Not a Cell", "<p>Not a Header|Not a Cell</p>"); |
640 |
|
|
641 |
2 |
test("|= cell 1.1 |= cell 1.2\n" + "|= cell 2.1|= cell 2.2", "" + "<table><tbody>\n" |
642 |
|
+ " <tr><th> cell 1.1 </th><th> cell 1.2</th></tr>\n" |
643 |
|
+ " <tr><th> cell 2.1</th><th> cell 2.2</th></tr>\n" + "</tbody></table>"); |
644 |
2 |
test("|= Head 1.1 |= Head 1.2\n" + "| cell 2.1| cell 2.2", "" + "<table><tbody>\n" |
645 |
|
+ " <tr><th> Head 1.1 </th><th> Head 1.2</th></tr>\n" |
646 |
|
+ " <tr><td> cell 2.1</td><td> cell 2.2</td></tr>\n" + "</tbody></table>"); |
647 |
2 |
test("|= Multi \nline \nheader \n" + "| Multi\nline\ncell\n" + "\n" + "One,two,three", "" + "<table><tbody>\n" |
648 |
|
+ " <tr><th> Multi \nline \nheader </th></tr>\n" + " <tr><td> Multi\nline\ncell</td></tr>\n" |
649 |
|
+ "</tbody></table>\n" + "<p>One,two,three</p>"); |
650 |
2 |
test("this is not |= a table", "<p>this is not |= a table</p>"); |
651 |
2 |
test("this is not | a table", "<p>this is not | a table</p>"); |
652 |
2 |
test("|Hi|Hello|\n\nSome Text", "<table><tbody>\n" + " <tr><td>Hi</td><td>Hello</td><td></td></tr>\n" |
653 |
|
+ "</tbody></table>\n" + "<p>Some Text</p>"); |
654 |
2 |
test("|cell\n\n(% name='value' %)\ntext", "<table><tbody>\n" + " <tr><td>cell</td></tr>\n" |
655 |
|
+ "</tbody></table>\n" + "<p name='value'>text</p>"); |
656 |
|
|
657 |
2 |
test("|= //Italic header// |= **Bold header**\n" + "| //Italic cell// | **Bold cell**\n", "" |
658 |
|
+ "<table><tbody>\n" |
659 |
|
+ " <tr><th> <em>Italic header</em> </th><th> <strong>Bold header</strong></th></tr>\n" |
660 |
|
+ " <tr><td> <em>Italic cell</em> </td><td> <strong>Bold cell</strong></td></tr>\n" |
661 |
|
+ "</tbody></table>"); |
662 |
2 |
test("|= //Italic header |= **Bold header \n" + "| //Italic cell | **Bold cell \n", "" + "<table><tbody>\n" |
663 |
|
+ " <tr><th> <em>Italic header </em></th><th> <strong>Bold header </strong></th></tr>\n" |
664 |
|
+ " <tr><td> <em>Italic cell </em></td><td> <strong>Bold cell </strong></td></tr>\n" |
665 |
|
+ "</tbody></table>"); |
666 |
|
|
667 |
|
|
668 |
2 |
test("|||cell13", "<table><tbody>\n" + " <tr><td></td><td></td><td>cell13</td></tr>\n" + "</tbody></table>"); |
669 |
|
|
670 |
|
|
671 |
2 |
test("(%a=b%)\n|= Header ", "" + "<table a='b'><tbody>\n" + " <tr><th> Header </th></tr>\n" |
672 |
|
+ "</tbody></table>"); |
673 |
2 |
test("(%a=b%)\n!= Header ", "" + "<table a='b'><tbody>\n" + " <tr><th> Header </th></tr>\n" |
674 |
|
+ "</tbody></table>"); |
675 |
2 |
test("(%a=b%)\n| cell ", "" + "<table a='b'><tbody>\n" + " <tr><td> cell </td></tr>\n" + "</tbody></table>"); |
676 |
2 |
test("(%a=b%)\n| cell ", "" + "<table a='b'><tbody>\n" + " <tr><td> cell </td></tr>\n" + "</tbody></table>"); |
677 |
|
|
678 |
|
|
679 |
2 |
test("(%a=b%)|=cell"); |
680 |
2 |
test("(%a=b%)!!cell1\n(%c=d%)!!cell2"); |
681 |
|
|
682 |
2 |
test("(%a=b%)\n(%c=d%)|=(%e=f%) cell"); |
683 |
2 |
test("(%a=b%)\n(%c=d%)!!(%e=f%) cell !!(%g=h%)"); |
684 |
|
|
685 |
|
|
686 |
|
|
687 |
2 |
test("|Bla\n(% param='value' %)\nBla Bla", "<table><tbody>\n" + |
688 |
|
" <tr><td>Bla</td></tr>\n" + |
689 |
|
"</tbody></table>\n" + |
690 |
|
"<p param='value'>Bla Bla</p>"); |
691 |
|
|
692 |
|
|
693 |
2 |
test("|cell\n(% param='value' %)\nparagraph|", "<table><tbody>\n" + |
694 |
|
" <tr><td>cell</td></tr>\n" + |
695 |
|
"</tbody></table>\n" + |
696 |
|
"<p param='value'>paragraph|</p>"); |
697 |
2 |
test("|Bla\n(% parm='value' %)\nBla Bla\n\n", "<table><tbody>\n" + |
698 |
|
" <tr><td>Bla</td></tr>\n" + |
699 |
|
"</tbody></table>\n" + |
700 |
|
"<p parm='value'>Bla Bla</p>"); |
701 |
|
} |
702 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (26) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
703 |
2 |
public void testVerbatim() throws WikiParserException... |
704 |
|
{ |
705 |
|
|
706 |
2 |
test("{{{verbatim}}}\n* not really", "<pre>verbatim</pre>\n<ul>\n <li>not really</li>\n</ul>"); |
707 |
|
|
708 |
2 |
test("this is {{{verbatim", "<p>this is <tt class=\"wikimodel-verbatim\">verbatim</tt></p>"); |
709 |
2 |
test("{{{abc}}}", "<pre>abc</pre>"); |
710 |
2 |
test("{{{{{{abc}}}}}}", "<pre>{{{abc}}}</pre>"); |
711 |
|
|
712 |
|
|
713 |
|
|
714 |
2 |
test("{{{abc}}}{{{cde}}}", |
715 |
|
"<p><tt class=\"wikimodel-verbatim\">abc</tt><tt class=\"wikimodel-verbatim\">cde</tt></p>"); |
716 |
2 |
test("{{{abc}}}after", "<p><tt class=\"wikimodel-verbatim\">abc</tt>after</p>"); |
717 |
2 |
test("before{{{abc}}}after", "<p>before<tt class=\"wikimodel-verbatim\">abc</tt>after</p>"); |
718 |
2 |
test("before{{{{{{abc}}}}}}after", "<p>before<tt class=\"wikimodel-verbatim\">{{{abc}}}</tt>after</p>"); |
719 |
2 |
test("}}}", "<p>}}}</p>"); |
720 |
2 |
test("{{{", "<pre></pre>"); |
721 |
2 |
test("{{{}}}\n\n{{{}}}", "<pre></pre>\n<pre></pre>"); |
722 |
2 |
test("some text {{{}}}\n\n{{{}}}", "<p>some text <tt class=\"wikimodel-verbatim\"></tt></p>\n<pre></pre>"); |
723 |
2 |
test( |
724 |
|
"{{{}}}\n{{{}}}\n{{{}}}", |
725 |
|
"<p><tt class=\"wikimodel-verbatim\"></tt>\n<tt class=\"wikimodel-verbatim\"></tt>\n<tt class=\"wikimodel-verbatim\"></tt></p>"); |
726 |
2 |
test("{{{}}}\n\n{{{}}}\n\n{{{}}}\n\n{{{}}}", "<pre></pre>\n<pre></pre>\n<pre></pre>\n<pre></pre>"); |
727 |
2 |
test("{{{}}}\nsome text", "<p><tt class=\"wikimodel-verbatim\"></tt>\nsome text</p>"); |
728 |
|
|
729 |
2 |
test("some text {{{}}}\nsome text", "<p>some text <tt class=\"wikimodel-verbatim\"></tt>\nsome text</p>"); |
730 |
|
|
731 |
|
|
732 |
2 |
test("{{{ ~}~}~} }}}", "<pre> }}} </pre>"); |
733 |
2 |
test("{{{ ~}}} }}}", "<pre> }}} </pre>"); |
734 |
2 |
test("{{{ ~}}~} }}}", "<pre> }}} </pre>"); |
735 |
2 |
test("{{{ ~}~}} }}}", "<pre> }}} </pre>"); |
736 |
2 |
test("{{{ ~{~{~{ }}}", "<pre> {{{ </pre>"); |
737 |
2 |
test("{{{ ~{{{ }}}", "<pre> {{{ </pre>"); |
738 |
2 |
test("{{{ ~{{~{ }}}", "<pre> {{{ </pre>"); |
739 |
2 |
test("{{{ ~{~{{ }}}", "<pre> {{{ </pre>"); |
740 |
2 |
test("{{{ ~ }}}", "<pre> ~ </pre>"); |
741 |
2 |
test("{{{ ~}~}~}", "<pre> }}}</pre>"); |
742 |
|
} |
743 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
744 |
2 |
public void testLink() throws WikiParserException... |
745 |
|
{ |
746 |
2 |
test("[[label>>reference||param=\"value ~\"value~\"\"]]", |
747 |
|
"<p><a href='reference' param='value "value"'>label</a></p>"); |
748 |
|
|
749 |
2 |
test("~[~[nolink]]\n[[[[>>reference]]\n~[~[whatever\n~[[[link]]\n[http://reference]", |
750 |
|
"<p>[[nolink]]\n<a href='reference'>[[</a>\n[[whatever\n" |
751 |
|
+ "[<a href='link' class='wikimodel-freestanding'>link</a>\n" |
752 |
|
+ "[<a href='http://reference' class='wikimodel-freestanding'>http://reference</a>]</p>"); |
753 |
|
|
754 |
|
} |
755 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1PASS
|
|
756 |
2 |
public void testEmptyLine() throws WikiParserException... |
757 |
|
{ |
758 |
2 |
test("paragraph\n\nparagraph", "<p>paragraph</p>\n<p>paragraph</p>"); |
759 |
|
|
760 |
2 |
test("paragraph\n\n\nparagraph", "<p>paragraph</p>\n<p>paragraph</p>"); |
761 |
2 |
test("paragraph\n\n\n\nparagraph", "<p>paragraph</p>\n<div style='height:2em;'></div>\n<p>paragraph</p>"); |
762 |
2 |
test("paragraph\n\n\n\n\nparagraph", "<p>paragraph</p>\n<div style='height:3em;'></div>\n<p>paragraph</p>"); |
763 |
|
|
764 |
2 |
test("paragraph\n\n\n\n----", "<p>paragraph</p>\n<div style='height:2em;'></div>\n<hr />"); |
765 |
2 |
test("paragraph\n\n\n\n\n----", "<p>paragraph</p>\n<div style='height:3em;'></div>\n<hr />"); |
766 |
|
} |
767 |
|
} |