Add a pretty PASSED! or FAILED! to the final summary line.
[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 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # (default) generate HTML output
9 # pst apply pre-save transform
10 # msg apply message transform
11 #
12 # Tests can be disabled with the '!!disabled' flag.
13 #
14 # For testing purposes, temporary articles can created:
15 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
16 # where '/' denotes a newline.
17
18 ###
19 ### Basic tests
20 ###
21 !! test
22 Blank input
23 !! input
24 !! result
25 !! end
26
27 !! test
28 Simple paragraph
29 !! input
30 This is a simple paragraph.
31 !! result
32 <p>This is a simple paragraph.
33 </p>
34 !! end
35
36 !! test
37 Simple list
38 !! input
39 * Item 1
40 * Item 2
41 !! result
42 <ul><li> Item 1
43 </li><li> Item 2
44 </li></ul>
45
46 !! end
47
48 !! test
49 Italics and bold
50 !! input
51 * plain
52 * plain''italic''plain
53 * plain''italic''plain''italic''plain
54 * plain'''bold'''plain
55 * plain'''bold'''plain'''bold'''plain
56 * plain''italic''plain'''bold'''plain
57 * plain'''bold'''plain''italic''plain
58 * plain''italic'''bold-italic'''italic''plain
59 * plain'''bold''bold-italic''bold'''plain
60 * plain'''''bold-italic'''italic''plain
61 * plain'''''bold-italic''bold'''plain
62 * plain''italic'''bold-italic'''''plain
63 * plain'''bold''bold-italic'''''plain
64 * plain l'''italic''plain
65 !! result
66 <ul><li> plain
67 </li><li> plain<i>italic</i>plain
68 </li><li> plain<i>italic</i>plain<i>italic</i>plain
69 </li><li> plain<b>bold</b>plain
70 </li><li> plain<b>bold</b>plain<b>bold</b>plain
71 </li><li> plain<i>italic</i>plain<b>bold</b>plain
72 </li><li> plain<b>bold</b>plain<i>italic</i>plain
73 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
74 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
75 </li><li> plain<i><b>bold-italic</b>italic</i>plain
76 </li><li> plain<b><i>bold-italic</i>bold</b>plain
77 </li><li> plain<i>italic<b>bold-italic</b></i>plain
78 </li><li> plain<b>bold<i>bold-italic</i></b>plain
79 </li><li> plain l'<i>italic</i>plain
80 </li></ul>
81
82 !! end
83
84 ###
85 ### <nowiki> test cases
86 ###
87
88 !! test
89 <nowiki> unordered list
90 !! input
91 <nowiki>* This is not an unordered list item.</nowiki>
92 !! result
93 <p>* This is not an unordered list item.
94 </p>
95 !! end
96
97 !! test
98 <nowiki> spacing
99 !! input
100 <nowiki>Lorem ipsum dolor
101
102 sed abit.
103 sed nullum.
104
105 :and a colon
106 </nowiki>
107 !! result
108 <p>Lorem ipsum dolor
109
110 sed abit.
111 sed nullum.
112
113 :and a colon
114
115 </p>
116 !! end
117
118 !! test
119 nowiki 3
120 !! input
121 :There is not nowiki.
122 :There is <nowiki>nowiki</nowiki>.
123
124 #There is not nowiki.
125 #There is <nowiki>nowiki</nowiki>.
126
127 *There is not nowiki.
128 *There is <nowiki>nowiki</nowiki>.
129 !! result
130 <dl><dd>There is not nowiki.
131 </dd><dd>There is nowiki.
132 </dd></dl>
133 <ol><li>There is not nowiki.
134 </li><li>There is nowiki.
135 </li></ol>
136 <ul><li>There is not nowiki.
137 </li><li>There is nowiki.
138 </li></ul>
139
140 !! end
141
142 ###
143 ### comment test cases
144 ###
145 !! test
146 comment test 1
147 !! input
148 <!-- comment 1 --> asdf
149 <!-- comment 2 -->
150 !! result
151 <pre>asdf
152 </pre>
153
154 !! end
155
156 !! test
157 comment test 2
158 !! input
159 asdf
160 <!-- comment 1 -->
161 jkl
162 !! result
163 <p>asdf
164 jkl
165 </p>
166 !! end
167
168 !! test
169 comment test 3
170 !! input
171 asdf
172 <!-- comment 1 -->
173 <!-- comment 2 -->
174 jkl
175 !! result
176 <p>asdf
177 jkl
178 </p>
179 !! end
180
181 !! test
182 comment test 4
183 !! input
184 asdf<!-- comment 1 -->jkl
185 !! result
186 <p>asdfjkl
187 </p>
188 !! end
189
190 ###
191 ### External links
192 ###
193 !! test
194 External links: non-bracketed
195 !! input
196 Non-bracketed: http://example.com
197 !! result
198 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
199 </p>
200 !! end
201
202 !! test
203 External links: numbered
204 !! input
205 Numbered: [http://example.com]
206 !! result
207 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
208 </p>
209 !!end
210
211 !! test
212 External links: specified text
213 !! input
214 Specified text: [http://example.com link]
215 !! result
216 <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>
217 </p>
218 !!end
219
220 !! test
221 External links: trail
222 !! input
223 Trail (not sure if this is meant to work): [http://example.com link]s
224 !! result
225 <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>
226 </p>
227 !! end
228
229 !! test
230 External links: dollar sign in URL
231 !! input
232 http://example.com/1$2345
233 !! result
234 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
235 </p>
236 !! end
237
238 !! test
239 External links: dollar sign in URL (named)
240 !! input
241 [http://example.com/1$2345]
242 !! result
243 <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>
244 </p>
245 !!end
246
247 !! test
248 External image
249 !! input
250 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
251 !! result
252 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
253 </p>
254 !! end
255
256 !! test
257 External image from https
258 !! input
259 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
260 !! result
261 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
262 </p>
263 !! end
264
265 !! test
266 Link to non-http image, no img tag
267 !! input
268 Link to non-http image, no img tag: ftp://example.com/test.jpg
269 !! result
270 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
271 </p>
272 !! end
273
274 !! test
275 External links: terminating separator
276 !! input
277 Terminating separator: http://example.com/thing,
278 !! result
279 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
280 </p>
281 !! end
282
283 !! test
284 External links: intervening separator
285 !! input
286 Intervening separator: http://example.com/1,2,3
287 !! result
288 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
289 </p>
290 !! end
291
292 !! test
293 External links: old bug with URL in query
294 !! input
295 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
296 !! result
297 <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>
298 </p>
299 !! end
300
301 !! test
302 External links: old URL-in-URL bug, mixed protocols
303 !! input
304 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
305 !! result
306 <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>
307 </p>
308 !!end
309
310 !! test
311 External links: URL in text
312 !! input
313 URL in text: [http://example.com http://example.com]
314 !! result
315 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
316 </p>
317 !! end
318
319 !! test
320 External links: Clickable images
321 !! input
322 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
323 !! result
324 <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>
325 </p>
326 !!end
327
328 !! test
329 External links: raw ampersand
330 !! input
331 Old &amp; use: http://x&y
332 !! result
333 <p>Old &amp; use: <a href="http://x&amp;y" class='external'>http://x&amp;y</a>
334 </p>
335 !! end
336
337 !! test
338 External links: www.jpeg.org (bug 554)
339 !! input
340 http://www.jpeg.org
341 !!result
342 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
343 </p>
344 !! end
345
346 ###
347 ### Quotes
348 ###
349
350 !! test
351 Quotes
352 !! input
353 Normal text. '''Bold text.''' Normal text. ''Italic text.''
354
355 Normal text. '''''Bold italic text.''''' Normal text.
356 !!result
357 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
358 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
359 </p>
360 !! end
361
362
363 !! test
364 Unclosed and unmatched quotes
365 !! input
366 '''''Bold italic text '''with bold deactivated''' in between.'''''
367
368 '''''Bold italic text ''with italic deactivated'' in between.'''''
369
370 '''Bold text..
371
372 ..spanning two paragraphs (should not work).'''
373
374 '''Bold tag left open
375
376 ''Italic tag left open
377
378 Normal text.
379
380 <!-- Unmatching number of opening, closing tags: -->
381 '''This year''''s election ''should'' beat '''last year''''s.
382
383 ''Tom'''s car is bigger than ''Susan'''s.
384 !! result
385 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
386 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
387 </p><p><b>Bold text..</b>
388 </p><p>..spanning two paragraphs (should not work).<b></b>
389 </p><p><b>Bold tag left open</b>
390 </p><p><i>Italic tag left open</i>
391 </p><p>Normal text.
392 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
393 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
394 </p>
395 !! end
396
397 ###
398 ### Tables
399 ###
400 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
401 ###
402 !! test
403 Simple table
404 !! input
405 {|
406 | 1 || 2
407 |-
408 | 3 || 4
409 |}
410 !! result
411 <table >
412 <tr >
413 <td> 1 </td><td> 2
414 </td></tr>
415 <tr >
416 <td> 3 </td><td> 4
417 </td></tr></table>
418
419 !! end
420
421 !! test
422 Multiplication table
423 !! input
424 {| border="1" cellpadding="2"
425 |+Multiplication table
426 |-
427 ! &times; !! 1 !! 2 !! 3
428 |-
429 ! 1
430 | 1 || 2 || 3
431 |-
432 ! 2
433 | 2 || 4 || 6
434 |-
435 ! 3
436 | 3 || 6 || 9
437 |-
438 ! 4
439 | 4 || 8 || 12
440 |-
441 ! 5
442 | 5 || 10 || 15
443 |}
444 !! result
445 <table border="1" cellpadding="2">
446 <caption>Multiplication table
447 </caption>
448 <tr >
449 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
450 </th></tr>
451 <tr >
452 <th> 1
453 </th><td> 1 </td><td> 2 </td><td> 3
454 </td></tr>
455 <tr >
456 <th> 2
457 </th><td> 2 </td><td> 4 </td><td> 6
458 </td></tr>
459 <tr >
460 <th> 3
461 </th><td> 3 </td><td> 6 </td><td> 9
462 </td></tr>
463 <tr >
464 <th> 4
465 </th><td> 4 </td><td> 8 </td><td> 12
466 </td></tr>
467 <tr >
468 <th> 5
469 </th><td> 5 </td><td> 10 </td><td> 15
470 </td></tr></table>
471
472 !! end
473
474 !! test
475 Table rowspan
476 !! input
477 {| align=right border=1
478 | Cell 1, row 1
479 |rowspan=2| Cell 2, row 1 (and 2)
480 | Cell 3, row 1
481 |-
482 | Cell 1, row 2
483 | Cell 3, row 2
484 |}
485 !! result
486 <table align=right border=1>
487 <tr >
488 <td> Cell 1, row 1
489 </td><td rowspan=2> Cell 2, row 1 (and 2)
490 </td><td> Cell 3, row 1
491 </td></tr>
492 <tr >
493 <td> Cell 1, row 2
494 </td><td> Cell 3, row 2
495 </td></tr></table>
496
497 !! end
498
499 !! test
500 Nested table
501 !! input
502 {| border=1
503 | &alpha;
504 |
505 {| bgcolor=#ABCDEF border=2
506 |nested
507 |-
508 |table
509 |}
510 |the original table again
511 |}
512 !! result
513 <table border=1>
514 <tr >
515 <td> &alpha;
516 </td><td>
517 <table bgcolor=#ABCDEF border=2>
518 <tr >
519 <td>nested
520 </td></tr>
521 <tr >
522 <td>table
523 </td></tr></table>
524 </td><td>the original table again
525 </td></tr></table>
526
527 !! end
528
529 ###
530 ### Internal links
531 ###
532 !! article
533 Main Page
534 !! text
535 blah blah
536 !! endarticle
537
538 !! test
539 Plain link, capitalized
540 !! input
541 [[Main Page]]
542 !! result
543 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
544 </p>
545 !! end
546
547 !! test
548 Plain link, uncapitalized
549 !! input
550 [[main Page]]
551 !! result
552 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
553 </p>
554 !! end
555
556 !! test
557 Piped link
558 !! input
559 [[Main Page|The Main Page]]
560 !! result
561 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
562 </p>
563 !! end
564
565 !! test
566 Broken link
567 !! input
568 [[Zigzagzogzagzig]]
569 !! result
570 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
571 </p>
572 !! end
573
574 !! test
575 Link with prefix
576 !! input
577 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
578 !! result
579 <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>
580 </p>
581 !! end
582
583 !! test
584 Link with suffix
585 !! input
586 [[Main Page]]xxx, [[Main Page]]XXX
587 !! result
588 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
589 </p>
590 !! end
591
592 !! test
593 Link with 3 brackets
594 !! input
595 [[[main page]]]
596 !! result
597 <p>[[[main page]]]
598 </p>
599 !! end
600
601 !! test
602 Piped link with 3 brackets
603 !! input
604 [[[main page|the main page]]]
605 !! result
606 <p>[[[main page|the main page]]]
607 </p>
608 !! end
609
610 !! test
611 Link to namespaces
612 !! input
613 [[Talk:Parser testing]], [[Meta:Disclaimers]]
614 !! result
615 <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>
616 </p>
617 !! end
618
619 !! test
620 Piped link to namespace
621 !! input
622 [[Meta:Disclaimers|The disclaimers]]
623 !! result
624 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
625 </p>
626 !! end
627
628 !! article
629 Category:MediaWiki User's Guide
630 !! text
631 blah
632 !! endarticle
633
634 !! test
635 Link to category
636 !! input
637 [[:Category:MediaWiki User's Guide]]
638 !! result
639 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
640 </p>
641 !! end
642
643 !! test
644 Link to image page
645 !! input
646 [[:Image:Ncwikicol.png]]
647 !! result
648 <p><a href="/wiki/Image:Ncwikicol.png" title="Image:Ncwikicol.png">Image:Ncwikicol.png</a>
649 </p>
650 !! end
651
652 !! test
653 Plain link to URL
654 !! input
655 [[http://www.example.org]]
656 !! result
657 <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>]
658 </p>
659 !! end
660
661 # I'm fairly sure the expected result here is wrong.
662 # We want these to be URL links, not pseudo-pages with URLs for titles....
663 # However the current output is also pretty screwy.
664 !! test
665 Piped link to URL
666 !! input
667 Piped link to URL: [[http://www.example.org|an example URL]]
668 !! result
669 <p>Piped link to URL: <a href="/index.php?title=Http://www.example.org&amp;action=edit" class="new" title="Http://www.example.org">an example URL</a>
670 </p>
671 !! end
672
673 !! test
674 BUG 2: [[page|http://url/]] should link to page, not http://url/
675 !! input
676 [[Main Page|http://url/]]
677 !! result
678 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
679 </p>
680 !! end
681
682
683 ###
684 ### Interwiki links
685 ###
686
687 !! test
688 Inline interwiki link
689 !! input
690 [[MeatBall:SoftSecurity]]
691 !! result
692 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
693 </p>
694 !! end
695
696 ###
697 ### Images
698 ###
699
700 !! test
701 [[
702
703
704 ##
705 ## XHTML tidiness
706 ###
707
708 !! test
709 <br> to <br />
710 !! input
711 1<br>2<br />3
712 !! result
713 <p>1<br />2<br />3
714 </p>
715 !! end
716
717 ###
718 ### Block-level elements
719 ###
720 !! test
721 Common list
722 !! input
723 *Common list
724 * item 2
725 *item 3
726 !! result
727 <ul><li>Common list
728 </li><li> item 2
729 </li><li>item 3
730 </li></ul>
731
732 !! end
733
734 !! test
735 Numbered list
736 !! input
737 #Numbered list
738 #item 2
739 # item 3
740 !! result
741 <ol><li>Numbered list
742 </li><li>item 2
743 </li><li> item 3
744 </li></ol>
745
746 !! end
747
748 !! test
749 Mixed list
750 !! input
751 *Mixed list
752 *# with numbers
753 ** and bullets
754 *# and numbers
755 *bullets again
756 **bullet level 2
757 ***bullet level 3
758 ***#Number on level 4
759 **bullet level 2
760 **#Number on level 3
761 **#Number on level 3
762 *#number level 2
763 *Level 1
764 !! result
765 <ul><li>Mixed list
766 <ol><li> with numbers
767 </li></ol>
768 <ul><li> and bullets
769 </li></ul>
770 <ol><li> and numbers
771 </li></ol>
772 </li><li>bullets again
773 <ul><li>bullet level 2
774 <ul><li>bullet level 3
775 <ol><li>Number on level 4
776 </li></ol>
777 </li></ul>
778 </li><li>bullet level 2
779 <ol><li>Number on level 3
780 </li><li>Number on level 3
781 </li></ol>
782 </li></ul>
783 <ol><li>number level 2
784 </li></ol>
785 </li><li>Level 1
786 </li></ul>
787
788 !! end
789
790 ###
791 ### Magic variables
792 ###
793 !! test
794 Magic variables
795 !! input
796 {{SITENAME}}
797 !! result
798 <p>MediaWiki
799 </p>
800 !! end
801
802 ###
803 ### Magic links
804 ###
805 !! test
806 Magic links: internal link to RFC
807 !! input
808 [[RFC 123]]
809 !! result
810 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
811 </p>
812 !! end
813
814 !! test
815 Magic links: ISBN
816 !! input
817 ISBN 0-306-40615-2
818 !! result
819 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
820 </p>
821 !! end
822
823 ###
824 ### Nonexistant template
825 ###
826 !! test
827 Nonexistant template
828 !! input
829 {{thistemplatedoesnotexist}}
830 !! result
831 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
832 </p>
833 !! end
834
835 ###
836 ### Templates
837 ####
838 !! article
839 Template:test
840 !! text
841 This is a test template
842 !! endarticle
843
844 !! test
845 Simple template
846 !! input
847 {{test}}
848 !! result
849 <p>This is a test template
850 </p>
851 !! end
852
853 !! test
854 Template with explicit namespace
855 !! input
856 {{Template:test}}
857 !! result
858 <p>This is a test template
859 </p>
860 !! end
861
862
863 !! article
864 Template:paramtest
865 !! text
866 This is a test template with parameter {{{param}}}
867 !! endarticle
868
869 !! test
870 Template parameter
871 !! input
872 {{paramtest|param=foo}}
873 !! result
874 <p>This is a test template with parameter foo
875 </p>
876 !! end
877
878 !! test
879 Magic variable as template parameter
880 !! input
881 {{paramtest|param={{SITENAME}}}}
882 !! result
883 <p>This is a test template with parameter MediaWiki
884 </p>
885 !! end
886
887 !! article
888 Template:linktest
889 !! text
890 [[{{{param}}}|link]]
891 !! endarticle
892
893 !! test
894 Template parameter as link source
895 !! input
896 {{linktest|param=Main Page}}
897 !! result
898 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
899 </p>
900 !! end
901
902
903 !! article
904 Template:Linktest2
905 !! text
906 Main Page
907 !! endarticle
908
909 !! test
910 Template as link source
911 !! input
912 [[{{linktest2}}]]
913 !! result
914 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
915 </p>
916 !! end
917
918 !! article
919 Template:loop1
920 !! text
921 {{loop2}}
922 !! endarticle
923
924 !! article
925 Template:loop2
926 !! text
927 {{loop1}}
928 !! endarticle
929
930 !! test
931 Template infinite loop
932 !! input
933 {{loop1}}
934 !! result
935 <p>{{loop2}}<!-- WARNING: template loop detected -->
936 </p>
937 !! end
938
939
940 ###
941 ### Pre-save transform tests
942 ###
943 !! test
944 pre-save transform: subst:
945 !! options
946 PST
947 !! input
948 {{subst:test}}
949 !! result
950 This is a test template
951 !! end
952
953 !! test
954 pre-save transform: normal template
955 !! options
956 PST
957 !! input
958 {{test}}
959 !! result
960 {{test}}
961 !! end
962
963 !! test
964 pre-save transform: nonexistant template
965 !! options
966 PST
967 !! input
968 {{thistemplatedoesnotexist}}
969 !! result
970 {{thistemplatedoesnotexist}}
971 !! end
972
973 !! test
974 pre-save transform: subst magic variables
975 !! options
976 PST
977 !! input
978 {{subst:SITENAME}}
979 !! result
980 MediaWiki
981 !! end
982
983 ###
984 ### Message transform tests
985 ###
986 !! test
987 message transform: magic variables
988 !! options
989 msg
990 !! input
991 {{SITENAME}}
992 !! result
993 MediaWiki
994 !! end
995
996 !! test
997 message transform: should not transform wiki markup
998 !! options
999 msg
1000 !! input
1001 ''test''
1002 !! result
1003 ''test''
1004 !! end
1005
1006 TODO:
1007 more templates
1008 tables
1009 images
1010 subpages
1011 character entities
1012 and much more
1013