Merge "5 new tests (3 Parsoid serializer, 2 parser) & fixed 4 tests."
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
index 809e3d6..540b6f4 100644 (file)
@@ -363,6 +363,16 @@ Italics and bold
 
 !! 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
 ###
@@ -397,13 +407,26 @@ Italics and bold: 2-quote opening sequence: (2,4)
 
 
 !! 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
 
 
 ###
@@ -441,13 +464,26 @@ Italics and bold: 3-quote opening sequence: (3,4)
 
 
 !! 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
 
 
 ###
@@ -485,13 +521,26 @@ Italics and bold: 4-quote opening sequence: (4,4)
 
 
 !! 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
 
 
 ###
@@ -499,13 +548,26 @@ Italics and bold: 4-quote opening sequence: (4,5)
 ###
 
 !! 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
@@ -571,23 +633,49 @@ Italics and bold: multiple quote sequences: (2,4,4)
 
 
 !! 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
@@ -622,14 +710,32 @@ Italics and bold: other quote tests: (3,2,3,2)
 !!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
@@ -2071,8 +2177,13 @@ Definition Lists: Nesting: Test 4
 !! 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
@@ -2087,7 +2198,19 @@ Definition Lists: Mixed Lists: Test 1
 </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
@@ -2219,9 +2342,15 @@ Definition Lists: Mixed Lists: Test 10
 
 !! 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
@@ -2239,10 +2368,23 @@ Definition Lists: Mixed Lists: Test 11
 </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
@@ -2256,6 +2398,15 @@ Definition Lists: Weird Ones: Test 1
 </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
 
 ###
@@ -2932,7 +3083,9 @@ Normal text. '''''Bold italic text.''''' Normal text.
 
 
 !! test
-Unclosed and unmatched quotes
+Unclosed and unmatched quotes (php)
+!! options
+php
 !! input
 '''''Bold italic text '''with bold deactivated''' in between.'''''
 
@@ -2967,6 +3120,48 @@ Plain ''italic'''s plain
 </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
@@ -2978,16 +3173,30 @@ Plain ''italic'''s plain
 # 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
@@ -2997,6 +3206,18 @@ A table with nothing but a 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
@@ -10700,10 +10921,22 @@ Handling of &#x0A; in URLs
 !!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