Add remotely fetched files to .cvsignore to reduce screen pollution
[mediawiki.git] / maintenance / parserTests.txt
blobc758319cbcad69d15a66697fc62e97fc62d20f66
1 # MediaWiki Parser test cases
2 # see also http://meta.wikimedia.org/wiki/Parser_testing
4 !! test
5 Blank input
6 !! input
7 !! result
8 !! end
10 !! test
11 Simple paragraph
12 !! input
13 This is a simple paragraph.
14 !! result
15 <p>This is a simple paragraph.
16 </p>
17 !! end
19 !! test
20 Simple list
21 !! input
22 * Item 1
23 * Item 2
24 !! result
25 <ul><li> Item 1
26 </li><li> Item 2
27 </li></ul>
28 !! end
30 !! test
31 Italics and bold
32 !! input
33 * plain
34 * plain''italic''plain
35 * plain''italic''plain''italic''plain
36 * plain'''bold'''plain
37 * plain'''bold'''plain'''bold'''plain
38 * plain''italic''plain'''bold'''plain
39 * plain'''bold'''plain''italic''plain
40 * plain''italic'''bold-italic'''italic''plain
41 * plain'''bold''bold-italic''bold'''plain
42 * plain'''''bold-italic'''italic''plain
43 * plain'''''bold-italic''bold'''plain
44 * plain''italic'''bold-italic'''''plain
45 * plain'''bold''bold-italic'''''plain
46 * plain l'''italic''plain
47 !! result
48 <ul><li> plain
49 </li><li> plain<i>italic</i>plain
50 </li><li> plain<i>italic</i>plain<i>italic</i>plain
51 </li><li> plain<b>bold</b>plain
52 </li><li> plain<b>bold</b>plain<b>bold</b>plain
53 </li><li> plain<i>italic</i>plain<b>bold</b>plain
54 </li><li> plain<b>bold</b>plain<i>italic</i>plain
55 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
56 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
57 </li><li> plain<i><b>bold-italic</b>italic</i>plain
58 </li><li> plain<b><i>bold-italic</i>bold</b>plain
59 </li><li> plain<i>italic<b>bold-italic</b></i>plain
60 </li><li> plain<b>bold<i>bold-italic</i></b>plain
61 </li><li> plain l'<i>italic</i>plain
62 </li></ul>
63 !! end
65 ###
66 ### <nowiki> test cases
67 ###
69 !! test
70 <nowiki> unordered list
71 !! input
72 <nowiki>* This is not an unordered list item.</nowiki>
73 !! result
74 <p>* This is not an unordered list item.
75 </p>
76 !! end
78 !! test
79 <nowiki> spacing
80 !! input
81 <nowiki>Lorem ipsum dolor
83 sed abit.
84   sed nullum.
86 :and a colon
87 </nowiki>
88 !! result
89 <p>Lorem ipsum dolor
91 sed abit.
92   sed nullum.
94 :and a colon
96 </p>
97 !! end
99 !! test
100 nowiki 3
101 !! input
102 :There is not nowiki.
103 :There is <nowiki>nowiki</nowiki>.
105 #There is not nowiki.
106 #There is <nowiki>nowiki</nowiki>.
108 *There is not nowiki.
109 *There is <nowiki>nowiki</nowiki>.
110 !! result
111 <dl><dd>There is not nowiki.
112 </dd><dd>There is nowiki.
113 </dd></dl>
114 <ol><li>There is not nowiki.
115 </li><li>There is nowiki.
116 </li></ol>
117 <ul><li>There is not nowiki.
118 </li><li>There is nowiki.
119 </li></ul>
120 !! end
123 ### comment test cases
125 !! test
126 comment test 1
127 !! input
128 <!-- comment 1 --> asdf
129 <!-- comment 2 -->
130 !! result
131 <pre>asdf
132 </pre>
133 !! end
135 !! test
136 comment test 2
137 !! input
138 asdf
139 <!-- comment 1 -->
141 !! result
142 <p>asdf
144 </p>
145 !! end
147 !! test
148 comment test 3
149 !! input
150 asdf
151 <!-- comment 1 -->
152 <!-- comment 2 -->
154 !! result
155 <p>asdf
157 </p>
158 !! end
160 !! test
161 comment test 4
162 !! input
163 asdf<!-- comment 1 -->jkl
164 !! result
165 <p>asdfjkl
166 </p>
167 !! end
170 ### External links
172 !! test
173 External links: non-bracketed
174 !! input
175 Non-bracketed: http://example.com
176 !! result
177 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
178 </p>
179 !! end
181 !! test
182 External links: numbered
183 !! input
184 Numbered: [http://example.com]
185 !! result
186 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
187 </p>
188 !!end
190 !! test
191 External links: specified text
192 !! input
193 Specified text: [http://example.com link]
194 !! result
195 <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>
196 </p>
197 !!end
199 !! test
200 External links: trail
201 !! input
202 Trail (not sure if this is meant to work): [http://example.com link]s
203 !! result
204 <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>
205 </p>
206 !! end
208 !! test
209 External links: dollar sign in URL
210 !! input
211 http://example.com/1$2345
212 !! result
213 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
214 </p>
215 !! end
217 !! test
218 External links: dollar sign in URL (named)
219 !! input
220 [http://example.com/1$2345]
221 !! result
222 <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>
223 </p>
224 !!end
226 !! test
227 External image
228 !! input
229 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
230 !! result
231 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
232 </p>
233 !! end
235 !! test
236 External image from https
237 !! input
238 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
239 !! result
240 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
241 </p>
242 !! end
244 !! test
245 Link to non-http image, no img tag
246 !! input
247 Link to non-http image, no img tag: ftp://example.com/test.jpg
248 !! result
249 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
250 </p>
251 !! end
253 !! test
254 External links: terminating separator
255 !! input
256 Terminating separator: http://example.com/thing,
257 !! result
258 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
259 </p>
260 !! end
262 !! test
263 External links: intervening separator
264 !! input
265 Intervening separator: http://example.com/1,2,3
266 !! result
267 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
268 </p>
269 !! end
271 !! test
272 External links: old bug with URL in query
273 !! input
274 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
275 !! result
276 <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>
277 </p>
278 !! end
280 !! test
281 External links: old URL-in-URL bug, mixed protocols
282 !! input
283 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
284 !! result
285 <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>
286 </p>
287 !!end
289 !! test
290 External links: URL in text
291 !! input
292 URL in text: [http://example.com http://example.com]
293 !! result
294 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
295 </p>
296 !! end
298 !! test
299 External links: Clickable images
300 !! input
301 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
302 !! result
303 <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>
304 </p>
305 !!end
307 !! test
308 External links: raw ampersand
309 !! input
310 Old &amp; use: http://x&y
311 !! result
312 <p>Old &amp; use: <a href="http://x&amp;y" class='external'>http://x&amp;y</a>
313 </p>
314 !! end
316 !! test
317 External links: www.jpeg.org (bug 554)
318 !! input
319 http://www.jpeg.org
320 !!result
321 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
322 </p>
323 !! end
326 ### Quotes
329 !! test
330 Quotes
331 !! input
332 Normal text. '''Bold text.''' Normal text. ''Italic text.''
334 Normal text. '''''Bold italic text.''''' Normal text.
335 !!result
336 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
337 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
338 </p>
339 !! end
342 !! test
343 Unclosed and unmatched quotes
344 !! input
345 '''''Bold italic text '''with bold deactivated''' in between.'''''
347 '''''Bold italic text ''with italic deactivated'' in between.'''''
349 '''Bold text..
351 ..spanning two paragraphs (should not work).'''
353 '''Bold tag left open
355 ''Italic tag left open
357 Normal text.
359 <!-- Unmatching number of opening, closing tags: -->
360 '''This year''''s election ''should'' beat '''last year''''s.
362 ''Tom'''s car is bigger than ''Susan'''s.
363 !! result
364 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
365 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
366 </p><p><b>Bold text..</b>
367 </p><p>..spanning two paragraphs (should not work).<b></b>
368 </p><p><b>Bold tag left open</b>
369 </p><p><i>Italic tag left open</i>
370 </p><p>Normal text.
371 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
372 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
373 </p>
374 !! end
377 ### Internal links
379 !! test
380 Plain link, capitalized
381 !! input
382 [[Main Page]]
383 !! result
384 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
385 </p>
386 !! end
388 !! test
389 Plain link, uncapitalized
390 !! input
391 [[main Page]]
392 !! result
393 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
394 </p>
395 !! end
397 !! test
398 Piped link
399 !! input
400 [[Main Page|The Main Page]]
401 !! result
402 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
403 </p>
404 !! end
406 !! test
407 Broken link
408 !! input
409 [[Zigzagzogzagzig]]
410 !! result
411 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
412 </p>
413 !! end
415 !! test
416 Link with prefix
417 !! input
418 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
419 !! result
420 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
421 </p>
422 !! end
424 !! test
425 Link with suffix
426 !! input
427 [[Main Page]]xxx, [[Main Page]]XXX
428 !! result
429 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
430 </p>
431 !! end
433 !! test
434 Link with 3 brackets
435 !! input
436 [[[main page]]]
437 !! result
438 <p>[[[main page]]]
439 </p>
440 !! end
442 !! test
443 Piped link with 3 brackets
444 !! input
445 [[[main page|the main page]]]
446 !! result
447 <p>[[[main page|the main page]]]
448 </p>
449 !! end
451 !! test
452 Link to namespaces
453 !! input
454 [[Talk:Parser testing]], [[Meta:Disclaimers]]
455 !! result
456 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
457 </p>
458 !! end
460 !! test
461 Piped link to namespace
462 !! input
463 [[Meta:Disclaimers|The disclaimers]]
464 !! result
465 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
466 </p>
467 !! end
469 !! test
470 Link to category
471 !! input
472 [[:Category:MediaWiki User's Guide]]
473 !! result
474 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
475 </p>
476 !! end
478 !! test
479 Link to image page
480 !! input
481 [[:Image:Ncwikicol.png]]
482 !! result
483 <p><a href="/wiki/Image:Ncwikicol.png" title="Image:Ncwikicol.png">Image:Ncwikicol.png</a>
484 </p>
485 !! end
487 !! test
488 Plain link to URL
489 !! input
490 [[http://www.example.org]]
491 !! result
492 <p>[<a href="http://www.example.org" class='external' title="http://www.example.org">[1]</a><span class='urlexpansion'> (<i>http://www.example.org</i>)</span>]
493 </p>
494 !! end
496 !! test
497 Piped link to URL
498 !! input
499 Piped link to URL: [[http://www.example.org|an example URL]]
500 !! result
501 <p>Piped link to URL: <a href="/index.php?title=http://www.example.org&amp;action=edit" class="new">an example URL</a>
502 </p>
503 !! end
505 !! test
506 BUG 2: [[page|http://url/]] should link to page, not http://url/
507 !! input
508 [[Main Page|http://url/]]
509 !! result
510 <p><a href="/wiki/Main_Page" title="Main Page">http://url</a>
511 </p>
512 !! end
516 ### Interwiki links
519 !! test
520 Inline interwiki link
521 !! input
522 [[MeatBall:SoftSecurity]]
523 !! result
524 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
525 </p>
526 !! end
530 ## XHTML tidiness
533 !! test
534 <br> to <br />
535 !! input
536 1<br>2<br />3
537 !! result
538 <p>1<br />2<br />3
539 </p>
540 !! end
543 ### Block-level elements
545 !! test
546 Common list
547 !! input
548 *Common list
549 * item 2
550 *item 3
551 !! result
552 <ul><li>Common list
553 </li><li> item 2
554 </li><li>item 3
555 </li></ul>
556 !! end
558 !! test
559 Numbered list
560 !! input
561 #Numbered list
562 #item 2
563 # item 3
564 !! result
565 <ol><li>Numbered list
566 </li><li>item 2
567 </li><li> item 3
568 </li></ol>
569 !! end
571 !! test
572 Mixed list
573 !! input
574 *Mixed list
575 *# with numbers
576 ** and bullets
577 *# and numbers
578 *bullets again
579 **bullet level 2
580 ***bullet level 3
581 ***#Number on level 4
582 **bullet level 2
583 **#Number on level 3
584 **#Number on level 3
585 *#number level 2
586 *Level 1
587 !! result
588 <ul><li>Mixed list
589 <ol><li> with numbers
590 </li></ol>
591 <ul><li> and bullets
592 </li></ul>
593 <ol><li> and numbers
594 </li></ol>
595 </li><li>bullets again
596 <ul><li>bullet level 2
597 <ul><li>bullet level 3
598 <ol><li>Number on level 4
599 </li></ol>
600 </li></ul>
601 </li><li>bullet level 2
602 <ol><li>Number on level 3
603 </li><li>Number on level 3
604 </li></ol>
605 </li></ul>
606 <ol><li>number level 2
607 </li></ol>
608 </li><li>Level 1
609 </li></ul>
610 !! end
613 ### Magic variables
615 !! test
616 Magic variables
617 !! input
618 {{SITENAME}}
619 !! result
620 <p>MediaWiki
621 </p>
622 !! end
625 ### Nonexistant template
627 !! test
628 Nonexistant template
629 !! input
630 {{thistemplatedoesnotexist}}
631 !! result
632 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
633 </p>
634 !! end