fix field names in PRIMARY KEY spec
[lhc/web/wiklou.git] / maintenance / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 # $Id$
5 #
6 # The syntax should be fairly self-explanatory.
7 #
8 # Currently supported test options:
9 # One of the following three:
10 #
11 # (default) generate HTML output
12 # pst apply pre-save transform
13 # msg apply message transform
14 #
15 # Plus any combination of these:
16 #
17 # cat add category links
18 # ill add inter-language links
19 # subpage enable subpages (disabled by default)
20 # title=[[XXX]] run test using article title XXX
21 # disabled do not run test
22 #
23 # For testing purposes, temporary articles can created:
24 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
25 # where '/' denotes a newline.
26
27 # This is the standard article assumed to exist.
28 !! article
29 Main Page
30 !! text
31 blah blah
32 !! endarticle
33
34 ###
35 ### Basic tests
36 ###
37 !! test
38 Blank input
39 !! input
40 !! result
41 !! end
42
43
44 !! test
45 Simple paragraph
46 !! input
47 This is a simple paragraph.
48 !! result
49 <p>This is a simple paragraph.
50 </p>
51 !! end
52
53 !! test
54 Simple list
55 !! input
56 * Item 1
57 * Item 2
58 !! result
59 <ul><li> Item 1
60 </li><li> Item 2
61 </li></ul>
62
63 !! end
64
65 !! test
66 Italics and bold
67 !! input
68 * plain
69 * plain''italic''plain
70 * plain''italic''plain''italic''plain
71 * plain'''bold'''plain
72 * plain'''bold'''plain'''bold'''plain
73 * plain''italic''plain'''bold'''plain
74 * plain'''bold'''plain''italic''plain
75 * plain''italic'''bold-italic'''italic''plain
76 * plain'''bold''bold-italic''bold'''plain
77 * plain'''''bold-italic'''italic''plain
78 * plain'''''bold-italic''bold'''plain
79 * plain''italic'''bold-italic'''''plain
80 * plain'''bold''bold-italic'''''plain
81 * plain l'''italic''plain
82 !! result
83 <ul><li> plain
84 </li><li> plain<i>italic</i>plain
85 </li><li> plain<i>italic</i>plain<i>italic</i>plain
86 </li><li> plain<b>bold</b>plain
87 </li><li> plain<b>bold</b>plain<b>bold</b>plain
88 </li><li> plain<i>italic</i>plain<b>bold</b>plain
89 </li><li> plain<b>bold</b>plain<i>italic</i>plain
90 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
91 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
92 </li><li> plain<i><b>bold-italic</b>italic</i>plain
93 </li><li> plain<b><i>bold-italic</i>bold</b>plain
94 </li><li> plain<i>italic<b>bold-italic</b></i>plain
95 </li><li> plain<b>bold<i>bold-italic</i></b>plain
96 </li><li> plain l'<i>italic</i>plain
97 </li></ul>
98
99 !! end
100
101 ###
102 ### <nowiki> test cases
103 ###
104
105 !! test
106 <nowiki> unordered list
107 !! input
108 <nowiki>* This is not an unordered list item.</nowiki>
109 !! result
110 <p>* This is not an unordered list item.
111 </p>
112 !! end
113
114 !! test
115 <nowiki> spacing
116 !! input
117 <nowiki>Lorem ipsum dolor
118
119 sed abit.
120 sed nullum.
121
122 :and a colon
123 </nowiki>
124 !! result
125 <p>Lorem ipsum dolor
126
127 sed abit.
128 sed nullum.
129
130 :and a colon
131
132 </p>
133 !! end
134
135 !! test
136 nowiki 3
137 !! input
138 :There is not nowiki.
139 :There is <nowiki>nowiki</nowiki>.
140
141 #There is not nowiki.
142 #There is <nowiki>nowiki</nowiki>.
143
144 *There is not nowiki.
145 *There is <nowiki>nowiki</nowiki>.
146 !! result
147 <dl><dd>There is not nowiki.
148 </dd><dd>There is nowiki.
149 </dd></dl>
150 <ol><li>There is not nowiki.
151 </li><li>There is nowiki.
152 </li></ol>
153 <ul><li>There is not nowiki.
154 </li><li>There is nowiki.
155 </li></ul>
156
157 !! end
158
159 ###
160 ### comment test cases
161 ###
162 !! test
163 Comment test 1
164 !! input
165 <!-- comment 1 --> asdf
166 <!-- comment 2 -->
167 !! result
168 <pre>asdf
169 </pre>
170
171 !! end
172
173 !! test
174 Comment test 2
175 !! input
176 asdf
177 <!-- comment 1 -->
178 jkl
179 !! result
180 <p>asdf
181 jkl
182 </p>
183 !! end
184
185 !! test
186 Comment test 3
187 !! input
188 asdf
189 <!-- comment 1 -->
190 <!-- comment 2 -->
191 jkl
192 !! result
193 <p>asdf
194 jkl
195 </p>
196 !! end
197
198 !! test
199 Comment test 4
200 !! input
201 asdf<!-- comment 1 -->jkl
202 !! result
203 <p>asdfjkl
204 </p>
205 !! end
206
207 !! test
208 Comment spacing
209 !! input
210 a
211 <!-- foo --> b <!-- bar -->
212 c
213 !! result
214 <p>a
215 </p>
216 <pre> b
217 </pre>
218 <p>c
219 </p>
220 !! end
221
222 ###
223 ### Preformatted text
224 ###
225 !! test
226 Preformatted text
227 !! input
228 This is some
229 Preformatted text
230 With ''italic''
231 And '''bold'''
232 And a [[Main Page|link]]
233 !! result
234 <pre>This is some
235 Preformatted text
236 With <i>italic</i>
237 And <b>bold</b>
238 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
239 </pre>
240 !! end
241
242 ###
243 ### Definition list
244 ###
245 !! test
246 Simple definition
247 !! input
248 ; name : Definition
249 !! result
250 <dl><dt> name&nbsp;</dt><dd> Definition
251 </dd></dl>
252
253 !! end
254
255 !! test
256 Simple definition
257 !! input
258 : Indented text
259 !! result
260 <dl><dd> Indented text
261 </dd></dl>
262
263 !! end
264
265 !! test
266 Definition list with no space
267 !! input
268 ;name:Definition
269 !! result
270 <dl><dt>name</dt><dd>Definition
271 </dd></dl>
272
273 !!end
274
275 !! test
276 Definition list with URL link
277 !! input
278 ; http://example.com/ : definition
279 !! result
280 <dl><dt> <a href="http://example.com/" class='external'>http://example.com/</a>&nbsp;</dt><dd> definition
281 </dd></dl>
282
283 !! end
284
285 !! test
286 Definition list with bracketed URL link
287 !! input
288 ;[http://www.google.com/ Google]:Number one search engine
289 !! result
290 <dl><dt><a href="http://www.google.com/" class='external' title="http://www.google.com/">Google</a><span class='urlexpansion'> (<i>http://www.google.com/</i>)</span></dt><dd>Number one search engine
291 </dd></dl>
292
293 !! end
294
295 !! test
296 Definition list with wikilink containing colon
297 !! input
298 ; [[Wikipedia:FAQ]]: The least-read page on Wikipedia
299 !! result
300 <dl><dt> <a href="http://en.wikipedia.org/wiki/FAQ" class='extiw'>Wikipedia:FAQ</a></dt><dd> The least-read page on Wikipedia
301 </dd></dl>
302
303 !! end
304
305 # At Brion's and JeLuF's insistence... :)
306 !! test
307 Definition list with wikilink containing colon
308 !! input
309 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
310 !! result
311 <dl><dt> <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
312 </dd></dl>
313
314 !! end
315
316 !! test
317 Malformed definition list with colon
318 !! input
319 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
320 !! result
321 <dl><dt> <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
322 </dt></dl>
323
324 !! end
325
326 !! test
327 Definition lists: colon in external link text
328 !! input
329 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
330 !! result
331 <dl><dt> <a href="http://www.wikipedia2.org/" class='external' title="http://www.wikipedia2.org/">Wikipedia&nbsp;: The Next Generation</a><span class='urlexpansion'> (<i>http://www.wikipedia2.org/</i>)</span></dt><dd> OK, I made that up
332 </dd></dl>
333
334 !! end
335
336
337 ###
338 ### External links
339 ###
340 !! test
341 External links: non-bracketed
342 !! input
343 Non-bracketed: http://example.com
344 !! result
345 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
346 </p>
347 !! end
348
349 !! test
350 External links: numbered
351 !! input
352 Numbered: [http://example.com]
353 !! result
354 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
355 </p>
356 !!end
357
358 !! test
359 External links: specified text
360 !! input
361 Specified text: [http://example.com link]
362 !! result
363 <p>Specified text: <a href="http://example.com" class='external' title="http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
364 </p>
365 !!end
366
367 !! test
368 External links: trail
369 !! input
370 Trail (not sure if this is meant to work): [http://example.com link]s
371 !! result
372 <p>Trail (not sure if this is meant to work): <a href="http://example.com" class='external' title="http://example.com">link</a>s<span class='urlexpansion'> (<i>http://example.com</i>)</span>
373 </p>
374 !! end
375
376 !! test
377 External links: dollar sign in URL
378 !! input
379 http://example.com/1$2345
380 !! result
381 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
382 </p>
383 !! end
384
385 !! test
386 External links: dollar sign in URL (named)
387 !! input
388 [http://example.com/1$2345]
389 !! result
390 <p><a href="http://example.com/1$2345" class='external' title="http://example.com/1$2345">[1]</a><span class='urlexpansion'> (<i>http://example.com/1$2345</i>)</span>
391 </p>
392 !!end
393
394 !! test
395 External image
396 !! input
397 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
398 !! result
399 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
400 </p>
401 !! end
402
403 !! test
404 External image from https
405 !! input
406 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
407 !! result
408 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
409 </p>
410 !! end
411
412 !! test
413 Link to non-http image, no img tag
414 !! input
415 Link to non-http image, no img tag: ftp://example.com/test.jpg
416 !! result
417 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
418 </p>
419 !! end
420
421 !! test
422 External links: terminating separator
423 !! input
424 Terminating separator: http://example.com/thing,
425 !! result
426 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
427 </p>
428 !! end
429
430 !! test
431 External links: intervening separator
432 !! input
433 Intervening separator: http://example.com/1,2,3
434 !! result
435 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
436 </p>
437 !! end
438
439 !! test
440 External links: old bug with URL in query
441 !! input
442 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
443 !! result
444 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class='external' title="http://example.com/thing?url=http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com/thing?url=http://example.com</i>)</span>
445 </p>
446 !! end
447
448 !! test
449 External links: old URL-in-URL bug, mixed protocols
450 !! input
451 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
452 !! result
453 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class='external' title="ftp://example.com?url=http://example.com">link</a><span class='urlexpansion'> (<i>ftp://example.com?url=http://example.com</i>)</span>
454 </p>
455 !!end
456
457 !! test
458 External links: URL in text
459 !! input
460 URL in text: [http://example.com http://example.com]
461 !! result
462 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
463 </p>
464 !! end
465
466 !! test
467 External links: Clickable images
468 !! input
469 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
470 !! result
471 <p>ja-style clickable images: <a href="http://example.com" class='external' title="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
472 </p>
473 !!end
474
475 !! test
476 External links: raw ampersand
477 !! input
478 Old &amp; use: http://x&y
479 !! result
480 <p>Old &amp; use: <a href="http://x&amp;y" class='external'>http://x&amp;y</a>
481 </p>
482 !! end
483
484 !! test
485 External links: www.jpeg.org (bug 554)
486 !! input
487 http://www.jpeg.org
488 !!result
489 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
490 </p>
491 !! end
492
493 !! test
494 External links: URL within URL (original bug 2)
495 !! input
496 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
497 !! result
498 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class='external' title="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a><span class='urlexpansion'> (<i>http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp</i>)</span>
499 </p>
500 !! end
501
502 !! test
503 BUG 361: URL inside bracketed URL
504 !! input
505 [http://www.example.com/foo http://www.example.com/bar]
506 !! result
507 <p><a href="http://www.example.com/foo" class='external' title="http://www.example.com/foo">http://www.example.com/bar</a><span class='urlexpansion'> (<i>http://www.example.com/foo</i>)</span>
508 </p>
509 !! end
510
511 !! test
512 BUG 289: ">"-token in URL-tail
513 !! input
514 http://www.example.com/<hello>
515 !! result
516 <p><a href="http://www.example.com/" class='external'>http://www.example.com/</a>&lt;hello&gt;
517 </p>
518 !!end
519
520 !! test
521 BUG 289: literal ">"-token in URL-tail
522 !! input
523 http://www.example.com/<b>html</b>
524 !! result
525 <p><a href="http://www.example.com/" class='external'>http://www.example.com/</a><b >html</b >
526 </p>
527 !!end
528
529 !! test
530 BUG 289: ">"-token in bracketed URL
531 !! input
532 [http://www.example.com/<hello> stuff]
533 !! result
534 <p><a href="http://www.example.com/" class='external' title="http://www.example.com/">&lt;hello&gt; stuff</a><span class='urlexpansion'> (<i>http://www.example.com/</i>)</span>
535 </p>
536 !!end
537
538 !! test
539 BUG 289: literal ">"-token in bracketed URL
540 !! input
541 [http://www.example.com/<b>html</b> stuff]
542 !! result
543 <p><a href="http://www.example.com/" class='external' title="http://www.example.com/"><b >html</b > stuff</a><span class='urlexpansion'> (<i>http://www.example.com/</i>)</span>
544 </p>
545 !!end
546
547 !! test
548 BUG 289: literal double quote at end of URL
549 !! input
550 http://www.example.com/"hello"
551 !! result
552 <p><a href="http://www.example.com/" class='external'>http://www.example.com/</a>"hello"
553 </p>
554 !!end
555
556 !! test
557 BUG 289: literal double quote in bracketed URL
558 !! input
559 [http://www.example.com/"hello" stuff]
560 !! result
561 <p><a href="http://www.example.com/" class='external' title="http://www.example.com/">"hello" stuff</a><span class='urlexpansion'> (<i>http://www.example.com/</i>)</span>
562 </p>
563 !!end
564
565 !! test
566 External links: invalid character
567 !! input
568 [http://www.example.com