Add tests for the just-fixed bug 553, and broken cases regarding
[lhc/web/wiklou.git] / maintenance / parserTests.txt
index 59a69f1..626ca4b 100644 (file)
@@ -5,9 +5,14 @@
 # The syntax should be fairly self-explanatory.
 #
 # Currently supported test options:
+#      One of the following three:
+#
 #      (default)       generate HTML output
 #      pst             apply pre-save transform
 #      msg             apply message transform
+#
+#      Plus any combination of these:
+#
 #      cat             add category links
 #      ill             add inter-language links
 #      subpage         enable subpages (disabled by default)
@@ -25,7 +30,6 @@ Main Page
 blah blah
 !! endarticle
 
-
 ###
 ### Basic tests
 ###
@@ -35,6 +39,7 @@ Blank input
 !! result
 !! end
 
+
 !! test
 Simple paragraph
 !! input
@@ -256,6 +261,78 @@ Simple definition
 
 !! end
 
+!! test
+Definition list with no space
+!! input
+;name:Definition
+!! result
+<dl><dt>name</dt><dd>Definition
+</dd></dl>
+
+!!end
+
+!! test
+Definition list with URL link
+!! input
+; http://example.com/ : definition
+!! result
+<dl><dt> <a href="http://example.com/" class='external'>http://example.com/</a>&nbsp;</dt><dd> definition
+</dd></dl>
+
+!! end
+
+!! test
+Definition list with bracketed URL link
+!! input
+;[http://www.google.com/ Google]:Number one search engine
+!! result
+<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
+</dd></dl>
+
+!! end
+
+!! test
+Definition list with wikilink containing colon
+!! input
+; [[Wikipedia:FAQ]]: The least-read page on Wikipedia
+!! result
+<dl><dt> <a href="http://en.wikipedia.org/wiki/FAQ" class='extiw'>Wikipedia:FAQ</a></dt><dd> The least-read page on Wikipedia
+</dd></dl>
+
+!! end
+
+# At Brion's and JeLuF's insistence... :)
+!! test
+Definition list with wikilink containing colon
+!! input
+;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
+!! result
+<dl><dt>  <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
+</dd></dl>
+
+!! end
+
+!! test
+Malformed definition list with colon
+!! input
+;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
+!! result
+<dl><dt>  <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
+</dt></dl>
+
+!! end
+
+!! test
+Definition lists: colon in external link text
+!! input
+; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
+!! result
+<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
+</dd></dl>
+
+!! end
+
+
 ###
 ### External links
 ###
@@ -759,14 +836,6 @@ Inline interwiki link
 </p>
 !! end
 
-###
-### Images
-###
-
-!! test
-[[
-
-
 ##
 ## XHTML tidiness
 ###
@@ -877,6 +946,15 @@ Magic links: internal link to RFC
 </p>
 !! end
 
+!! test
+Magic links: RFC
+!! input
+RFC 822
+!! result
+<p><a href='http://www.faqs.org/rfcs/rfc822.html' class='external' title="http://www.faqs.org/rfcs/rfc822.html">RFC 822</a>
+</p>
+!! end
+
 !! test
 Magic links: ISBN
 !! input
@@ -939,6 +1017,35 @@ Template parameter
 </p>
 !! end
 
+!! article
+Template:paramtestnum
+!! text
+[[{{{1}}}|{{{2}}}]]
+!! endarticle
+
+!! test
+Template unnamed parameter
+!! input
+{{paramtestnum|Main Page|the main page}}
+!! result
+<p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
+</p>
+!! end
+
+!! test
+BUG 553: link with two variables in a piped link
+!! input
+{| 
+|[[{{{1}}}|{{{2}}}]]
+|}
+!! result
+<table >
+<tr >
+<td>[[{{{1}}}|{{{2}}}]]
+</td></tr></table>
+
+!! end
+
 !! test
 Magic variable as template parameter
 !! input
@@ -1016,6 +1123,14 @@ Template infinite loop
 </p>
 !! end
 
+!! test
+Template from main namespace
+!! input
+{{:Main Page}}
+!! result
+<p>blah blah
+</p>
+!! end
 
 !! article
 Template:table
@@ -1071,6 +1186,40 @@ BUG 41: Template parameters shown as broken links
 </p>
 !! end
 
+
+!! article
+Template:MSGNW test
+!! text
+''None'' of '''this''' should be 
+* interepreted
+ but rather passed unmodified
+{{test}}
+!! endarticle
+
+# hmm, fix this or just deprecate msgnw and document its behavior?
+!! test
+msgnw keyword
+!! options
+disabled
+!! input
+{{msgnw:MSGNW test}}
+!! result
+<p>''None'' of '''this''' should be 
+* interepreted
+ but rather passed unmodified
+{{test}}
+</p>
+!! end
+
+!! test
+int keyword
+!! input
+{{int:newmessages|lots of money}}
+!! result
+<p>You have lots of money.
+</p>
+!! end
+
 ###
 ### Pre-save transform tests
 ###
@@ -1157,7 +1306,7 @@ Simple image
 !! input
 [[Image: test]]
 !! result
-<p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="Image: test" /></a>
+<p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/images/0/0c/Test" alt="Image: test" /></a>
 </p>
 !! end
 
@@ -1166,7 +1315,7 @@ Right-aligned image
 !! input
 [[Image:test|right]]
 !! result
-<div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="right"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="right" /></a></span></div>
+<div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="right"><img src="/images/0/0c/Test" alt="right" /></a></span></div>
 
 !! end
 
@@ -1175,7 +1324,7 @@ Image with caption
 !! input
 [[Image:test|right|Caption text]]
 !! result
-<div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="Caption text"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="Caption text" /></a></span></div>
+<div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="Caption text"><img src="/images/0/0c/Test" alt="Caption text" /></a></span></div>
 
 !! end
 
@@ -1184,7 +1333,7 @@ Image with frame and link
 !! input
 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
 !! result
-<div class="thumb tleft"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image "><img src="/%7Ewmahan/phase3/images/3/3a/Foobar.jpg" alt="This is a test image " width="200" height="200" /></a>  <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
+<div class="thumb tleft"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image "><img src="/images/3/3a/Foobar.jpg" alt="This is a test image " width="200" height="200" /></a>  <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
 
 !! end
 
@@ -1197,6 +1346,32 @@ Link to image page
 </p>
 !! end
 
+!! test
+Image caption with a free URL
+!! input
+[[Image:foo|http://example.com]]
+!! result
+<p><a href="/wiki/Image:Foo" class="image" title="http://example.com"><img src="/images/1/13/Foo" alt="http://example.com" />http://example.com</a>
+</p>
+!! end
+
+!! test
+Thumbnail image caption with a free URL
+!! input
+[[Image:foo|thumb|http://example.com]]
+!! result
+<div class="thumb tright"><div style="width:182px;"><b>Missing image</b><br /><i>Foo</i>   <div class="thumbcaption" ><a href="http://example.com" class='external'>http://example.com</a></div></div></div>
+!! end
+
+!! test
+Image caption with a link
+!! input
+[[Image:foo|text with a [[link]] in it]]
+!! result
+<p><a href="/wiki/Image:Foo" class="image" title="text with a link in it"><img src="/images/1/13/Foo" alt="text with a link in it" /></a>
+</p>
+!! end
+
 ###
 ### Subpages
 ###
@@ -1228,20 +1403,19 @@ subpage title=[[Subpage test]]
 </p>
 !! end
 
-# bug 561: it would be nice if this linked to /subpage -- wtm
 !! test
 Disabled subpages
 !! input
 [[/subpage]]
 !! result
-<p><a href="/index.php?title=Subpage&amp;action=edit" class="new" title="Subpage">subpage</a>
+<p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
 </p>
 !! end
 
 !! test
 BUG 561: {{/Subpage}}
 !! options
-title=[[Page]]
+subpage title=[[Page]]
 !! input
 {{/Subpage}}
 !! result
@@ -1374,6 +1548,41 @@ Resolving duplicate section names
 
 !! end
 
+!! article
+Template:sections
+!! text
+===Section 1===
+==Section 2==
+!! endarticle
+
+!! test
+Template with sections, __NOTOC__
+!! options title=[[Parser test script]]
+!! input
+__NOTOC__
+==Section 0==
+{{sections}}
+==Section 4==
+!! result
+<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
+<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
+<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
+<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
+
+!! end
+
+!! test
+__NOEDITSECTION__ keyword
+!! input
+__NOEDITSECTION__
+==Section 1==
+==Section 2==
+!! result
+<a name="Section_1"></a><h2>Section 1</h2>
+<a name="Section_2"></a><h2>Section 2</h2>
+
+!! end
+
 TODO:
 more images
 more tables