From 3bf46cc4eae7fe8833a27779e6aa77fff9623871 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Tue, 9 Dec 2014 18:00:48 -0500 Subject: [PATCH] Sync up with Parsoid parserTests. This now aligns with Parsoid commit ced8a485d503dd8aa4884894b7288efc34d95f6a Change-Id: I0850a9c39ca703ad40c897378a099efbe1418b29 --- tests/parser/parserTests.txt | 416 ++++++++++++++++++++++++++--------- 1 file changed, 307 insertions(+), 109 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 648c495bf3..77694c219e 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -16,7 +16,7 @@ # cat add category links # ill add inter-language links # subpage enable subpages (disabled by default) -# noxml don't check for XML well formdness +# noxml don't check for XML well-formedness # title=[[XXX]] run test using article title XXX # language=XXX set content language to XXX for this test # variant=XXX set the variant of language for this test (eg zh-tw) @@ -538,7 +538,6 @@ Italics and bold: 2-quote opening sequence: (2,2)

!!end - !! test Italics and bold: 2-quote opening sequence: (2,3) !! options @@ -550,18 +549,16 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki !! wikitext -''foo''' +''foo''' !! html

foo'

!! end - !! test Italics and bold: 2-quote opening sequence: (2,4) !! options @@ -573,18 +570,16 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki !! wikitext -''foo'''' +''foo'''' !! html

foo''

!! end - # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 2-quote opening sequence: (2,5) @@ -620,13 +615,24 @@ Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki !! test Italics and bold: 3-quote opening sequence: (3,2) +!! options +parsoid=wt2html !! wikitext '''foo'' -!! html +!! html/*

'foo

!!end +# same html as previous, but wikitext adjusted to match parsoid html2wt +!! test +Italics and bold: 3-quote opening sequence: (3,2) w/ nowiki +!! wikitext +'''foo'' +!! html +

'foo +

+!!end !! test Italics and bold: 3-quote opening sequence: (3,3) @@ -637,7 +643,6 @@ Italics and bold: 3-quote opening sequence: (3,3)

!!end - !! test Italics and bold: 3-quote opening sequence: (3,4) !! options @@ -649,18 +654,16 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki !! wikitext -'''foo'''' +'''foo'''' !! html

foo'

!! end - # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 3-quote opening sequence: (3,5) @@ -705,7 +708,6 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki @@ -716,16 +718,26 @@ Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki

!! end - !! test Italics and bold: 4-quote opening sequence: (4,3) +!! options +parsoid=wt2html !! wikitext ''''foo''' -!! html +!! html/*

'foo

!!end +# same html as previous, but wikitext adjusted to match parsoid html2wt +!! test +Italics and bold: 4-quote opening sequence: (4,3) w/ nowiki +!! wikitext +''''foo''' +!! html +

'foo +

+!!end !! test Italics and bold: 4-quote opening sequence: (4,4) @@ -738,18 +750,16 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki !! wikitext -''''foo'''' +''''foo'''' !! html

'foo'

!! end - # The PHP parser strips the empty tags out for giggles; parsoid doesn't. !! test Italics and bold: 4-quote opening sequence: (4,5) @@ -769,7 +779,7 @@ parsoid=wt2html !! test Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki !! wikitext -''''foo''''''' +''''foo''''''' !! html/php

'foo

@@ -794,7 +804,6 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt # skipping wt2html and html2html because it wants to put before !! test @@ -819,7 +828,6 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 5-quote opening sequence: (5,3+2) @@ -830,7 +838,6 @@ Italics and bold: 5-quote opening sequence: (5,3+2)

!! end - !! test Italics and bold: 5-quote opening sequence: (5,4) !! options @@ -842,18 +849,16 @@ parsoid=wt2html

!!end - # same html as previous, but wikitext adjusted to match parsoid html2wt !! test Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki !! wikitext -'''''foo'''''' +'''''foo'''''' !! html

foo'

!! end - !! test Italics and bold: 5-quote opening sequence: (5,5) !! wikitext @@ -882,7 +887,7 @@ parsoid=wt2html !! test Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki !! wikitext -''foo''''bar''''' +''foo''''bar''''' !! html

foo'bar

@@ -905,7 +910,7 @@ parsoid=wt2html !! test Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki !! wikitext -''foo''''bar''''' +''foo''''bar''''' !! html

foo'bar

@@ -928,7 +933,7 @@ parsoid=wt2html !! test Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki !! wikitext -''foo''''bar'''''' +''foo''''bar'''''' !! html

foo'bar'

@@ -1030,14 +1035,11 @@ parsoid=wt2html # same html as previous, but wikitext adjusted to match parsoid html2wt -# add 'parsoid' option to use 'parsoid' normalization of the placeholder !! test Italics and bold: other quote tests: (3,2,3+2+2,2) -!! options -parsoid !! wikitext '''this is about ''foo'''''''s family'' -!! html/* +!! html

this is about foos family

!! end @@ -1046,8 +1048,20 @@ parsoid !! test Italics and bold: other quote tests: (3,2,3,3) !! options +parsoid=wt2html !! wikitext '''this is about ''foo'''s family''' +!! html/* +

'this is about foos family +

+!!end + + +# same html as previous, but wikitext adjusted to match parsoid html2wt +!! test +Italics and bold: other quote tests: (3,2,3,3) w/ nowiki +!! wikitext +'''this is about ''foo'''s family''' !! html

'this is about foos family

@@ -1776,7 +1790,7 @@ b ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore ## them for now. !! test -P-wrapping should leave sol-transparent tags outside p-tags where possible +1. P-wrapping should leave sol-transparent tags outside p-tags where possible !! options parsoid=wt2html !! wikitext @@ -1788,6 +1802,16 @@ a [[Category:A1]] [[Category:A2]] !! end +!! test +2. P-wrapping should leave sol-transparent tags outside p-tags where possible +!! options +parsoid=wt2html +!! wikitext +[[Category:A1]]a +!! html/parsoid +

a

+!! end + ### ### Preformatted text ### @@ -2244,7 +2268,8 @@ parsoid=wt2html
!! html/parsoid -

<pre

x
+
x
+

<pre

@@ -2423,6 +2448,41 @@ Templates: Handle comments in the target

foo

!!end +!! test +Templates: Handle comments in parameter names (bug 67657) +!! wikitext +{{echo|1 + +=foo}} + +{{echo| + +1 = foo}} + +{{echo|1 = foo}} + +{{echo|1 = foo}} +!!html/parsoid +

foo

+ +

foo

+ +

foo

+ +

foo

+!!end + +!! test +Templates: Other wikitext in parameter names (bug 67657) +!! wikitext +{{echo|''1''=foo}} +!!html/parsoid +

{{{1}}}

+!!html/php +

{{{1}}} +

+!!end + #-------------------------------------------------------------------- # Transclusion parameter escaping tests #-------------------------------------------------------------------- @@ -5465,6 +5525,9 @@ Template-generated table cell attributes and cell content {| |{{table_attribs}} | {{table_attribs}} +| {{table_attribs}} +|align=center {{table_attribs}} +| align=center {{table_attribs}} |} !! html @@ -5472,26 +5535,18 @@ Template-generated table cell attributes and cell content
Foo Foo -
- -!! end - -!! test -Template-generated table cell attributes and cell content (2) -!! wikitext -{| -|align=center {{table_attribs}} -|} -!! html - - + + +
Foo + Foo + Foo
!! end !! test -Template-generated table cell attributes and cell content (3) +Template-generated table cell attributes and cell content (2) !! wikitext {| |align=center {{table_cells}} @@ -6335,7 +6390,7 @@ Link containing double-single-quotes '' in text embedded in italics (bug 4598 sa !! test Link with double quotes in title part (literal) and alternate part (interpreted) !! wikitext -[[File:Denys Savchenko ''Pentecoste''.jpg]] +[[File:Denys_Savchenko_''Pentecoste''.jpg]] [[''Pentecoste'']] @@ -6349,7 +6404,7 @@ Link with double quotes in title part (literal) and alternate part (interpreted)

Pentecoste

!! html/parsoid - +

''Pentecoste''

Pentecoste

Pentecoste

@@ -6359,15 +6414,20 @@ Link with double quotes in title part (literal) and alternate part (interpreted) Broken image links with HTML captions (bug 39700) !! wikitext [[File:Nonexistent|]] -[[File:Nonexistent|100px|]] +[[File:Nonexistent|100x100px|]] [[File:Nonexistent|<]] [[File:Nonexistent|abc]] -!! html +!! html/php

<script></script> <script></script> < abc

+!! html/parsoid +

+ + +

!! end !! test @@ -6941,6 +7001,8 @@ parsoid=wt2html,wt2wt,html2html !! test Interlanguage link +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[zh:Chinese]] @@ -6969,6 +7031,8 @@ Blah blah blah !! test Double interlanguage link +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[es:Spanish]] @@ -6984,17 +7048,23 @@ Blah blah blah !! test Interlanguage link variations +!! options +parsoid=wt2html,wt2wt,html2html !! wikitext Blah blah blah [[ es :Spanish]] [[ ZH :Chinese]] +[[es:Foo_bar]] +[[es:Foo bar]] !! html/php

Blah blah blah

!! html/parsoid

Blah blah blah

- - + + + + !! end !! test @@ -7398,6 +7468,8 @@ Failing to transform badly formed HTML into correct XHTML

!!end +## FIXME: Is Parsoid's acceptance of self-closing html-tags +## a feature or a bug? See https://phabricator.wikimedia.org/T76962 !! test Handling html with a div self-closing tag !! wikitext @@ -7407,7 +7479,7 @@ Handling html with a div self-closing tag
-!! html +!! html/php

<div title /> <div title/>

@@ -7418,6 +7490,13 @@ Handling html with a div self-closing tag
+!! html/parsoid +
+
+
+
+
+
!! end !! test @@ -7440,7 +7519,7 @@ Handling html with a br self-closing tag !! html/parsoid



-
+



@@ -8988,8 +9067,7 @@ Template with complex template as argument !! test Template with thumb image (with link in description) !! wikitext -{{paramtest| - param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} +{{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! html/php This is a test template with parameter

@@ -9000,6 +9078,8 @@ This is a test template with parameter
+!! html/parsoid +

This is a test template with parameter

link caption
!! end !! article @@ -12092,11 +12172,13 @@ File:Barfoo.jpg #REDIRECT [[File:Barfoo.jpg]] !! endarticle +# FIXME: Parsoid should run this test -- but we'd need to teach the +# mockAPI about the redirected Barfoo.jpg image. !! test Redirected image !! wikitext [[Image:Barfoo.jpg]] -!! html +!! html/php

File:Barfoo.jpg

!! end @@ -12106,10 +12188,12 @@ Missing image with uploads disabled !! options wgEnableUploads=0 !! wikitext -[[Image:Foobaz.jpg]] -!! html +[[File:Foobaz.jpg]] +!! html/php

File:Foobaz.jpg

+!! html/parsoid +

!! end # Parsoid-specific testing for images @@ -12348,7 +12432,12 @@ subpage title=[[Subpage test]]

!! end -# TODO: make this PHP-parser compatible! +!! article +Subpage test/1/2/subpage +!! text +blah +!! endarticle + !! test Relative subpage noslash link !! options @@ -12358,8 +12447,12 @@ subpage title=[[Subpage test/1/2/3/4]] [[../../subpage/]] [[../../subpage]] -!! html -

subpage

+!! html/php +

subpage +

Subpage test/1/2/subpage +

+!! html/parsoid +

subpage

Subpage_test/1/2/subpage

!! end @@ -13696,19 +13789,23 @@ Media link to nonexistent file (bug 1702) !! test Image link to nonexistent file (bug 1850 - good) !! wikitext -[[Image:No such.jpg]] -!! html +[[File:No_such.jpg]] +!! html/php

File:No such.jpg

+!! html/parsoid +

!! end !! test :Image link to nonexistent file (bug 1850 - bad) !! wikitext [[:Image:No such.jpg]] -!! html +!! html/php

Image:No such.jpg

+!! html/parsoid +

Image:No such.jpg

!! end @@ -15067,7 +15164,7 @@ Fuzz testing: image with bogus manual thumbnail
Error creating thumbnail:
!! html/parsoid - +
!!end !! test @@ -16650,9 +16747,11 @@ Image with page parameter djvu !! wikitext [[File:LoremIpsum.djvu|page=2]] -!! html +!! html/php

LoremIpsum.djvu

+!! html/parsoid +

!! end !! test @@ -18181,30 +18280,34 @@ comment ABC3D% ++ +%20 !! end -# FIXME: Omitting the php sections here because of differences in the local and -# jenkins output. But, more importantly, the Bad.jpg isn't being stripped, -# which seems to be a problem with the testing infrastructure. +# Parsoid doesn't support this yet: see bug 73581 +# but it *should* omit the 'src' attribute if the image is bad. +# PHP side of tests was disabled in +# mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c +# because of issues in the PHP parserTests infrastructure +# (but the output below is indeed what the PHP side emits) !! test Bad images - basic functionality !! wikitext [[File:Bad.jpg]] +!! DISABLED/html/php !! html/parsoid - +

!! end -# FIXME: Same reasoning as above. The expected php is: -#

Foo bar -#

Bar foo -#

!! test Bad images - bug 16039: text after bad image disappears !! wikitext Foo bar [[File:Bad.jpg]] Bar foo +!! DISABLED/html/php +

Foo bar +

Bar foo +

!! html/parsoid

Foo bar - + Bar foo

!! end @@ -18418,14 +18521,16 @@ percent-encoding and + signs in internal links (Bug 26410) !! wikitext [[User:+%]] [[Page+title%]] [[%+]] [[%+|%20]] [[%+ ]] [[%+r]] -[[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]] +[[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]] [[%33%45]] [[%33%45+]] -!! html +!! html/php

User:+% Page+title% %+ %20 %+ %+r % + bar 3E 3E+

+!! html/parsoid +

User:+% Page+title% %+ %20 %+ %+r % + 3E 3E+

!! end !! test @@ -18433,13 +18538,15 @@ Special characters in embedded file links (bug 27679) !! wikitext [[File:Contains & ampersand.jpg]] [[File:Does not exist.jpg|Title with & ampersand]] -!! html +!! html/php

File:Contains & ampersand.jpg Title with & ampersand

+!! html/parsoid +

+

!! end - !! test Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4) !! wikitext @@ -19424,6 +19531,22 @@ A foo
  • ↑ foo
  • !!end +!!test +Ref: 17. Generate valid HTML5 id/about attributes +!!options +parsoid +!!wikitext +foo + + +!!html +

    [1] +

    + +
      +
    1. ↑ foo
    2. +!!end + !!test References: 1. references tag without any refs should be handled properly !!options @@ -19561,7 +19684,7 @@ parsoid !! wikitext hi !! html -

      [1]

      +

      [1]

      !! end # This test is wt2html only because we're permitting the serializer to produce @@ -20575,24 +20698,24 @@ ISBN 1234567890's !! options parsoid=html2wt,wt2wt !! wikitext -'''foo''' +'''foo''' ''''foo'''' '''''foo''''' ''foo'''s -''''foo'''' +''''foo'''' '''''foo''''' ''''''foo'''''' -'''foo'''bar'''baz''' +'''foo'''bar'''baz''' '''foo''''s -'''foo'' +'''foo'' ''foo''' '''foo''' -''''foo''' +''''foo''' '''foo'''' ''''foo'''' ''fools' errand'' ''fool's errand'' -!! html +!! html/*

      'foo' ''foo'' '''foo''' @@ -20607,9 +20730,10 @@ parsoid=html2wt,wt2wt 'foo' 'foo foo' -'foo'

      +'foo' fools' errand fool's errand +

      !! end !! test @@ -21246,15 +21370,12 @@ parsoid !!test Multi-line image caption generated by templates with/without trailing newlines -!!options -parsoid !! wikitext -[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]] -[[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]] -!! html -
      File:Foo.jpg
      foo\nA\nB\nC
      -
      File:Foo.jpg
      foo\nA\nB\nC\n\n
      - +[[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]] +[[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]] +!! html/parsoid +
      foo\nA\nB\nC
      +
      foo\nA\nB\nC\n\n
      !!end !! test @@ -21558,6 +21679,17 @@ parsoid=html2wt !!end +!! test +Don't block XML namespace declaration +!! wikitext +MediaWiki +!! html/php +

      MediaWiki +

      +!! html/parsoid +

      MediaWiki

      +!! end + # ----------------------------------------------------------------- # The following section of tests are primarily to spec requirements # around serialization of new/edited content. @@ -21576,6 +21708,64 @@ parsoid=html2wt

      Foo

      !! end +!! test +New wiki links (href variations) +!! options +parsoid=html2wt +!! html +Foo_bar +Foo_bar +Foo_bar +Toxine bactérienne +!! wikitext +[[Foo_bar]] +[[Foo_bar]] +[[Foo_bar]] +[[Toxine bactérienne]] +!! end + +!! test +New wiki links (content string variations) +!! options +parsoid=html2wt +!! html +Foo_bar +Foo bar +./Foo_bar +!! wikitext +[[Foo_bar]] +[[Foo bar]] +[[Foo_bar|./Foo_bar]] +!! end + +!! test +New category links (href variations) +!! options +parsoid=html2wt +!! html + + + +!! wikitext +[[Category:Toxine bactérienne]] +[[Category:Toxine bactérienne]] +[[Category:Toxine bactérienne]] +!! end + +!! test +New interlanguage links (href variations) +!! options +parsoid=html2wt +!! html + + + +!! wikitext +[[es:Toxine bactérienne]] +[[es:Toxine_bactérienne]] +[[es:Toxine_bactérienne]] +!! end + !! test Image: Modifying size of an image (1) !! options @@ -21718,33 +21908,31 @@ parsoid #!! options #parsoid=html2wt #language=ar -#!! input +#!! wikitext #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]] -#!! result +#!! html #
      #!! end !! test Image: Block level image should have \n before and after -!! options -parsoid !! wikitext 123 [[File:Foobar.jpg|right|thumb|150x150px]] 456 -!! html -

      123

      456

      +!! html/parsoid +

      123

      +
      +

      456

      !!end !! test Image: New block level image should have \n before and after (existing content) -!! options -parsoid !! wikitext 123 [[File:Foobar.jpg|right|thumb|150x150px]] 456 -!! html +!! html/parsoid

      123

      456

      @@ -22050,7 +22238,7 @@ parsoid=html2wt !! wikitext ''A''B -''A'''''B''' +''A'''''B''' !! html

      AB

      AB

      @@ -22201,6 +22389,16 @@ parsoid=html2wt !! end +!! test +T75121: Infer extension name from typeOf if data-mw is not present +!! options +parsoid=html2wt +!! wikitext + +!! html +
      +!! end + # ----------------------------------------------------------------- # End of section for Parsoid-only html2wt tests for serialization # of new content -- 2.20.1