From 9dc5cdd5a3220fa83096a2352fcce25a59a3e82a Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Tue, 4 Dec 2012 12:15:15 -0600 Subject: [PATCH] New parser tests to spec wikitext behavior found on en:WP * 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 | 148 +++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 41deec0228..652fa43e39 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -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 +
+ + +
+
a +
b +
+
+
  • c +
  • d +
+
+ + +!!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 + + + +
bar +
+ +!!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|
  • }}a +{{echo|
  • }}b +{{echo|
  • }}c +!!result +
  • a +
  • b +
  • c
  • + + + +!!end ### ### Magic Words @@ -5000,6 +5075,40 @@ Un-closed !! result !! end +!!test +Self-closed noinclude, includeonly, onlyinclude tags +!!input + + + +!!result +


    +

    +!!end + +!!test +Unbalanced includeonly and noinclude tags +!!input +{| +|a
    +|b +|c +|d +|} +!!result + + + + + +
    a +b +c</includeonly> +d</includeonly></includeonly> +
    + +!!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 + +
    + +!!end + +!!test +Templates: Wiki Tables: 4. Templated tags, regular td-tags +!!input +{{tbl-start}} +|foo +{{tbl-end}} +!!result + + +
    foo +
    + +!!end + +!!test +Templates: Wiki Tables: 4. Templated tags, templated td-tags +!!input +{{tbl-start}} +{{!}}foo +{{tbl-end}} +!!result + + +
    foo +
    + +!!end + !!test Templates: Lists: Multi-line list-items via templates !!input -- 2.20.1