Merge "5 new tests (3 Parsoid serializer, 2 parser) & fixed 4 tests."
authorGWicke <gwicke@wikimedia.org>
Mon, 15 Apr 2013 16:46:32 +0000 (16:46 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 15 Apr 2013 16:46:32 +0000 (16:46 +0000)
1  2 
tests/parser/parserTests.txt

@@@ -363,16 -363,6 +363,16 @@@ Italics and bol
  
  !! end
  
 +# this example taken from the simple/Moon article
 +!! test
 +Italics and possessives
 +!! input
 +obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
 +!! result
 +<p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
 +</p>
 +!! end
 +
  ###
  ### 2-quote opening sequence tests
  ###
@@@ -407,26 -397,13 +407,26 @@@ Italics and bold: 2-quote opening seque
  
  
  !! test
 -Italics and bold: 2-quote opening sequence: (2,5)
 +Italics and bold: 2-quote opening sequence: (2,5) (php)
 +!! options
 +php
  !! input
  ''foo'''''
  !! result
  <p><i>foo</i>
  </p>
  !!end
 +# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 +!! test
 +Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
 +!! options
 +parsoid
 +!! input
 +''foo'''''
 +!! result
 +<p><i>foo</i><b></b>
 +</p>
 +!!end
  
  
  ###
@@@ -464,26 -441,13 +464,26 @@@ Italics and bold: 3-quote opening seque
  
  
  !! test
 -Italics and bold: 3-quote opening sequence: (3,5)
 +Italics and bold: 3-quote opening sequence: (3,5) (php)
 +!! options
 +php
  !! input
  '''foo'''''
  !! result
  <p><b>foo</b>
  </p>
  !!end
 +# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 +!! test
 +Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
 +!! options
 +parsoid
 +!! input
 +'''foo'''''
 +!! result
 +<p><b>foo<i></i></b>
 +</p>
 +!!end
  
  
  ###
@@@ -521,26 -485,13 +521,26 @@@ Italics and bold: 4-quote opening seque
  
  
  !! test
 -Italics and bold: 4-quote opening sequence: (4,5)
 +Italics and bold: 4-quote opening sequence: (4,5) (php)
 +!! options
 +php
  !! input
  ''''foo'''''
  !! result
  <p>'<b>foo</b>
  </p>
  !!end
 +# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 +!! test
 +Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
 +!! options
 +parsoid
 +!! input
 +''''foo'''''
 +!! result
 +<p>'<b>foo<i></i></b>
 +</p>
 +!!end
  
  
  ###
  ###
  
  !! test
 -Italics and bold: 5-quote opening sequence: (5,2)
 +Italics and bold: 5-quote opening sequence: (5,2) (php)
 +!! options
 +php
  !! input
  '''''foo''
  !! result
  <p><b><i>foo</i></b>
  </p>
  !!end
 +# Parsoid reverses the nesting order, compared to the PHP parser
 +!! test
 +Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
 +!! options
 +parsoid
 +!! input
 +'''''foo''
 +!! result
 +<p><i><b>foo</b></i>
 +</p>
 +!!end
  
  
  !! test
@@@ -633,49 -571,23 +633,49 @@@ Italics and bold: multiple quote sequen
  
  
  !! test
 -Italics and bold: multiple quote sequences: (3,4,2)
 +Italics and bold: multiple quote sequences: (3,4,2) (php)
 +!! options
 +php
  !! input
  '''foo''''bar''
  !! result
  <p><b>foo'</b>bar
  </p>
  !!end
 +# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 +!! test
 +Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
 +!! options
 +parsoid
 +!! input
 +'''foo''''bar''
 +!! result
 +<p><b>foo'</b>bar<i></i>
 +</p>
 +!!end
  
  
  !! test
 -Italics and bold: multiple quote sequences: (3,4,3)
 +Italics and bold: multiple quote sequences: (3,4,3) (php)
 +!! options
 +php
  !! input
  '''foo''''bar'''
  !! result
  <p><b>foo'</b>bar
  </p>
  !!end
 +# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 +!! test
 +Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
 +!! options
 +parsoid
 +!! input
 +'''foo''''bar'''
 +!! result
 +<p><b>foo'</b>bar<b></b>
 +</p>
 +!!end
  
  ###
  ### other quote tests
@@@ -710,32 -622,14 +710,32 @@@ Italics and bold: other quote tests: (3
  !!end
  
  
 +# The Parsoid team believes the PHP parser's output on this test is wrong.
 +# It only checks for convert-to-bold-on-single-character-word when the word
 +# matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
 +# This means that the bold token in position 2 (0-indexed) gets converted by
 +# parsoid, but doesn't get changed by the PHP parser.
  !! test
 -Italics and bold: other quote tests: (3,2,3,3)
 +Italics and bold: other quote tests: (3,2,3,3) (php)
 +!! options
 +php
  !! input
  '''this is about ''foo'''s family'''
  !! result
  <p>'<i>this is about </i>foo<b>s family</b>
  </p>
  !!end
 +# This is the output the Parsoid team believes to be correct.
 +!! test
 +Italics and bold: other quote tests: (3,2,3,3) (parsoid)
 +!! options
 +parsoid
 +!! input
 +'''this is about ''foo'''s family'''
 +!! result
 +<p><b>this is about <i>foo'</i>s family</b>
 +</p>
 +!!end
  
  
  !! test
@@@ -2177,13 -2071,8 +2177,13 @@@ Definition Lists: Nesting: Test 
  !! end
  
  
 +## The Parsoid team believes the following three test exposes a
 +## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
 +## wrong to close the <dl> after the <dt> containing the <ul>.)
  !! test
 -Definition Lists: Mixed Lists: Test 1
 +Definition Lists: Mixed Lists: Test 1 (php)
 +!! options
 +php
  !! input
  :;* foo
  ::* bar
  </dd></dl>
  
  !! end
 -
 +!! test
 +Definition Lists: Mixed Lists: Test 1 (parsoid)
 +!! options
 +parsoid
 +!! input
 +:;* foo
 +::* bar
 +:; baz
 +!! result
 +<dl><dd><dl><dt><ul><li> foo
 +</li></ul></dt><dd><ul><li> bar
 +</li></ul></dd><dt> baz</dt></dl></dd></dl>
 +!! end
  
  !! test
  Definition Lists: Mixed Lists: Test 2
@@@ -2342,15 -2219,9 +2342,15 @@@ Definition Lists: Mixed Lists: Test 1
  
  !! end
  
 +# The Parsoid team disagrees with the PHP parser's seemingly-random
 +# rules regarding dd/dt on the next two tests.  Parsoid is more
 +# consistent, and recognizes the shared nesting and keeps the
 +# still-open tags around until the nesting is complete.
  
  !! test
 -Definition Lists: Mixed Lists: Test 11
 +Definition Lists: Mixed Lists: Test 11 (php)
 +!! options
 +php
  !! input
  *#*#;*;;foo :bar
  *#*#;boo :baz
  </li></ul>
  
  !! end
 +!! test
 +Definition Lists: Mixed Lists: Test 11 (parsoid)
 +!! options
 +parsoid
 +!! input
 +*#*#;*;;foo :bar
 +*#*#;boo :baz
 +!! result
 +<ul><li><ol><li><ul><li><ol><li><dl><dt><ul><li><dl><dt><dl><dt>foo&nbsp;</dt><dd>bar
 +</dd></dl></dt></dl></li></ul></dt><dt>boo&nbsp;</dt><dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
 +!! end
  
  
  !! test
 -Definition Lists: Weird Ones: Test 1
 +Definition Lists: Weird Ones: Test 1 (php)
 +!! options
 +php
  !! input
  *#;*::;; foo : bar (who uses this?)
  !! result
  </li></ol>
  </li></ul>
  
 +!! end
 +!! test
 +Definition Lists: Weird Ones: Test 1 (parsoid)
 +!! options
 +parsoid
 +!! input
 +*#;*::;; foo : bar (who uses this?)
 +!! result
 +<ul><li><ol><li><dl><dt><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> foo&nbsp;</dt><dd> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
  !! end
  
  ###
@@@ -3083,9 -2932,7 +3083,9 @@@ Normal text. '''''Bold italic text.''''
  
  
  !! test
 -Unclosed and unmatched quotes
 +Unclosed and unmatched quotes (php)
 +!! options
 +php
  !! input
  '''''Bold italic text '''with bold deactivated''' in between.'''''
  
@@@ -3120,48 -2967,6 +3120,48 @@@ Plain ''italic'''s plai
  </p><p>Plain <i>italic'</i>s plain
  </p>
  !! end
 +# Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
 +# parser strips. The wikitext contains just the first half of the bold
 +# quote pair. (There's also a case where Parsoid nests <b> and <i>
 +# differently than the PHP parser.)
 +!! test
 +Unclosed and unmatched quotes (parsoid)
 +!! options
 +parsoid
 +!! input
 +'''''Bold italic text '''with bold deactivated''' in between.'''''
 +
 +'''''Bold italic text ''with italic deactivated'' in between.'''''
 +
 +'''Bold text..
 +
 +..spanning two paragraphs (should not work).'''
 +
 +'''Bold tag left open
 +
 +''Italic tag left open
 +
 +Normal text.
 +
 +<!-- Unmatching number of opening, closing tags: -->
 +'''This year''''s election ''should'' beat '''last year''''s.
 +
 +''Tom'''s car is bigger than ''Susan'''s.
 +
 +Plain ''italic'''s plain
 +!! result
 +<p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
 +</p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
 +</p><p><b>Bold text..</b>
 +</p><p>..spanning two paragraphs (should not work).<b></b>
 +</p><p><b>Bold tag left open</b>
 +</p><p><i>Italic tag left open</i>
 +</p><p>Normal text.
 +</p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
 +</p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
 +</p><p>Plain <i>italic'</i>s plain
 +</p>
 +!! end
  
  ###
  ### Tables
  # is the bare minimun required by the spec, see:
  # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
  !! test
 -A table with no data.
 +A table with no data. (php)
 +!! options
 +php
  !! input
  {||}
  !! result
  !! end
 +# Parsoid team replies: empty table tags are legal in HTML5
 +!! test
 +A table with no data. (parsoid)
 +!! options
 +parsoid
 +!! input
 +{||}
 +!! result
 +<table></table>
 +!! end
  
  # A table with nothing but a caption is invalid XHTML, we might want to render
  # this as <p>caption</p>
  !! test
 -A table with nothing but a caption
 +A table with nothing but a caption (php)
 +!! options
 +php
  !! input
  {|
  |+ caption
  <caption> caption
  </caption><tr><td></td></tr></table>
  
 +!! end
 +# Parsoid team replies: table with only a caption is legal in HTML5
 +!! test
 +A table with nothing but a caption (parsoid)
 +!! options
 +parsoid
 +!! input
 +{|
 +|+ caption
 +|}
 +!! result
 +<table><caption> caption</caption></table>
  !! end
  
  !! test
@@@ -3751,7 -3530,6 +3751,6 @@@ parsoi
  <table>
  <tbody>
  <tr>
- <td></td>
  <td>foo</td></tr></tbody></table>
  !! end
  
@@@ -4467,7 -4245,7 +4466,7 @@@ Horizontal ruler -- eats additional das
  !! end
  
  !! test
- Horizontal ruler -- does not collaps dashes on consecutive lines
+ Horizontal ruler -- does not collapse dashes on consecutive lines
  !! input
  ----
  ----
@@@ -10922,22 -10700,10 +10921,22 @@@ Handling of &#x0A; in URL
  !!end
  
  !! test
 -5 quotes, code coverage +1 line
 +5 quotes, code coverage +1 line (php)
 +!! options
 +php
 +!! input
 +'''''
 +!! result
 +!! end
 +# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
 +!! test
 +5 quotes, code coverage +1 line (parsoid)
 +!! options
 +parsoid
  !! input
  '''''
  !! result
 +<p><i><b></b></i></p>
  !! end
  
  !! test
  </pre>
  !! end
  
+ !!test
+ Parsing of overlapping (improperly nested) inline html tags (PHP parser)
+ !!options
+ php
+ !!input
+ <span><s>x</span></s>
+ !!result
+ <p><span><s>x&lt;/span&gt;</s></span>
+ </p>
+ !!end
+ !!test
+ Parsing of overlapping (improperly nested) inline html tags (Parsoid)
+ !!options
+ parsoid
+ !!input
+ <span><s>x</span></s>
+ !!result
+ <p><span><s>x</s></span><s></s>
+ </p>
+ !!end
  
  ###
  ### Language variants related tests
@@@ -14505,7 -14292,7 +14525,7 @@@ RT-ed inter-element separators should b
  Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
  (Parsoid-only since PHP parser relies on Tidy for correct output)
  !!options
disabled parsoid
+ parsoid
  !!input
  {|
  |<small>foo
@@@ -14537,11 -14324,30 +14557,30 @@@ Empty TD followed by TD with tpl-genera
  
  !!end
  
+ !!test
+ Indented table with an empty td
+ !!input
+  {|
+  |-
+  |
+  |foo
+  |}
+ !!result
+ <table>
+ <tr>
+ <td>
+ </td>
+ <td>foo
+ </td></tr></table>
+ !!end
  !!test
  Empty TR followed by a template-generated TR
  (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
  !!options
disabled parsoid
+ parsoid
  !!input
  {|
  |-
  <table>
  <tbody>
  <tr>
- <td></td></tr>
+ </tr>
  <tr>
  <td>foo</td></tr></tbody></table>
  !!end
  
+ ## PHP and parsoid output differ for this, and since this is primarily
+ ## for testing Parsoid's serializer, marking this Parsoid only
+ !!test
+ Empty TR followed by mixed-ws-comment line should RT correctly
+ !!options
+ parsoid
+ !!input
+ {|
+ |-
+  <!--c-->
+ |-
+ <!--c--> <!--d-->
+ |}
+ !!result
+ <table>
+ <tbody>
+ <tr>
+ <td> <!--c--></td></tr>
+ <tr>
+ <td><!--c--> <!--d--></td></tr>
+ </table>
+ !!end
  !!test
  Multi-line image caption generated by templates with/without trailing newlines
  !!options
@@@ -14569,6 -14399,21 +14632,21 @@@ parsoi
  
  !!end
  
+ ## PHP emits broken html for this, and since this is primarily
+ ## a Parsoid serializer test, marking this Parsoid only
+ !!test
+ Improperly nested inline or quotes tags with whitespace in between
+ !!options
+ parsoid
+ !!input
+ <span> <s>x</span> </s>
+ ''' ''x''' ''
+ !!result
+ <p><span> <s>x</s></span><s> </s>
+ <b> <i>x</i></b><i> </i></span>
+ </p>
+ !!end
  TODO:
  more images
  more tables