Additional tests to keep Parsoid on track.
authorSubramanya Sastry <ssastry@wikimedia.org>
Thu, 11 Oct 2012 16:54:09 +0000 (11:54 -0500)
committerSubramanya Sastry <ssastry@wikimedia.org>
Thu, 11 Oct 2012 17:01:35 +0000 (12:01 -0500)
Change-Id: Ic57c10f8e5ff16446834af4a22043465aa0495ce

tests/parser/parserTests.txt

index 61cf508..c9d916d 100644 (file)
@@ -71,6 +71,12 @@ Template:echo
 {{{1}}}
 !! endarticle
 
+!! article
+Template:attr_str
+!! text
+{{{1}}}="{{{2}}}"
+!! endarticle
+
 ###
 ### Basic tests
 ###
@@ -4046,6 +4052,14 @@ Template parameter as link source
 </p>
 !! end
 
+!!test
+Template-generated attribute string (k='v')
+!!input
+<span {{attr_str|id|v1}}>bar</span>
+!!result
+<p><span id="v1">bar</span>
+</p>
+!!end
 
 !!article
 Template:paramtest2
@@ -4325,6 +4339,15 @@ section=1
 ###
 ### <includeonly> and <noinclude> in attributes
 ###
+!!test
+0. includeonly around the entire attribute
+!!input
+<span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
+!!result
+<p><span id="v2">bar</span>
+</p>
+!!end
+
 !!test
 1. includeonly in html attr key
 !!input
@@ -5363,6 +5386,15 @@ Image with caption
 
 !! end
 
+!! test
+Image with empty attribute
+!! input
+[[Image:foobar.jpg|right||Caption text]]
+!! result
+<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
+
+!! end
+
 !! test
 Image with link parameter, wiki target
 !! input
@@ -11158,31 +11190,8 @@ HttP://MediaWiki.Org/
 ### Parsoids-specific tests
 ### Parsoid-PHP parser incompatibilities
 ###
-
-!!test
-1. includeonly around the entire attribute
-!!options
-disabled
-!!input
-<span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
-!!result
-<p><span>bar</span>
-</p>
-!!end
-
-!!test
-2. template around the entire attribute
-!!options
-disabled
-!!input
-<span {{echo|id="v1"}}>bar</span>
-!!result
-<p><span>bar</span>
-</p>
-!!end
-
 !!test
-3. SOL-sensitive wikitext tokens as template-args
+1. SOL-sensitive wikitext tokens as template-args
 !!options
 disabled
 !!input