New parser tests to spec wikitext behavior found on en:WP
authorSubramanya Sastry <ssastry@wikimedia.org>
Tue, 4 Dec 2012 18:15:15 +0000 (12:15 -0600)
committerSubramanya Sastry <ssastry@wikimedia.org>
Tue, 4 Dec 2012 18:22:20 +0000 (12:22 -0600)
* Added tests for:
  - table-list nesting interactions
  - templated-table tags
  - templated-list tags
  - stray *include* tags
  - autoclosed *include* tags

* These tests should help catch regressions from recent
  Parsoid fixes.

Change-Id: I54f0c13a16f4330fa258ff3718921b71bdafa6f0

tests/parser/parserTests.txt

index 41deec0..652fa43 100644 (file)
@@ -65,6 +65,18 @@ Template:inner list
 * item 1
 !! endarticle
 
+!! article
+Template:tbl-start
+!! text
+{|
+!! endarticle
+
+!! article
+Template:tbl-end
+!! text
+|}
+!! endarticle
+
 !! article
 Template:!
 !! text
@@ -1673,6 +1685,39 @@ Table / list interaction: indented table with lists in table contents
 
 !! end
 
+!!test
+Table / list interaction: lists nested in tables nested in indented lists
+!!input
+:{|
+|
+:a
+:b
+|
+*c
+*d
+|}
+
+*e
+*f
+!!result
+<dl><dd><table>
+<tr>
+<td>
+<dl><dd>a
+</dd><dd>b
+</dd></dl>
+</td>
+<td>
+<ul><li>c
+</li><li>d
+</li></ul>
+</td></tr></table></dd></dl>
+<ul><li>e
+</li><li>f
+</li></ul>
+
+!!end
+
 !! test
 Definition Lists: Nesting: Multi-level (Parsoid only)
 !! options
@@ -2861,6 +2906,22 @@ Accept empty attributes in td/th cells (td/th cells starting with leading ||)
 
 !! end
 
+!!test
+Accept "| !" at start of line in tables (ignore !-attribute)
+!!input
+{|
+|-
+| !style="color:red" | bar
+|}
+!!result
+<table>
+
+<tr>
+<td> bar
+</td></tr></table>
+
+!!end
+
 !!test
 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/- 
 !!input
@@ -4044,6 +4105,20 @@ List interrupted by empty line or heading
 
 !!end
 
+!!test
+Multiple list tags generated by templates
+!!input
+{{echo|<li>}}a
+{{echo|<li>}}b
+{{echo|<li>}}c
+!!result
+<li>a
+<li>b
+<li>c</li>
+</li>
+</li>
+
+!!end
 
 ###
 ### Magic Words
@@ -5000,6 +5075,40 @@ Un-closed <onlyinclude>
 !! result
 !! end
 
+!!test
+Self-closed noinclude, includeonly, onlyinclude tags
+!!input
+<noinclude />
+<includeonly />
+<onlyinclude />
+!!result
+<p><br />
+</p>
+!!end
+
+!!test
+Unbalanced includeonly and noinclude tags
+!!input
+{|
+|a</noinclude>
+|b</noinclude></noinclude>
+|c</noinclude></includeonly>
+|d</includeonly></includeonly>
+|}
+!!result
+<table>
+<tr>
+<td>a
+</td>
+<td>b
+</td>
+<td>c&lt;/includeonly&gt;
+</td>
+<td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
+</td></tr></table>
+
+!!end
+
 !! article
 Template:Includeonly section
 !! text
@@ -5479,6 +5588,45 @@ Templates: Wiki Tables: 3. td-content via multiple templates
 
 !!end
 
+!!test
+Templates: Wiki Tables: 4. Templated tags, no content
+!!input
+{{tbl-start}}
+{{tbl-end}}
+!!result
+<table>
+<tr><td></td></tr></table>
+
+!!end
+
+!!test
+Templates: Wiki Tables: 4. Templated tags, regular td-tags
+!!input
+{{tbl-start}}
+|foo
+{{tbl-end}}
+!!result
+<table>
+<tr>
+<td>foo
+</td></tr></table>
+
+!!end
+
+!!test
+Templates: Wiki Tables: 4. Templated tags, templated td-tags
+!!input
+{{tbl-start}}
+{{!}}foo
+{{tbl-end}}
+!!result
+<table>
+<tr>
+<td>foo
+</td></tr></table>
+
+!!end
+
 !!test
 Templates: Lists: Multi-line list-items via templates
 !!input