From c808d0aefad544910ce3cb18daaac291749cf744 Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 6 Sep 2017 16:32:34 -0400 Subject: [PATCH] Sync up with Parsoid parserTests.txt This now aligns with Parsoid commit 3648950432dd65a7cb4a1f80184e72f301a9ca57 Change-Id: I6ec86f7296eb51683b53dbbf0d26f5a87b84e6c7 --- tests/parser/parserTests.txt | 1230 +++++++++++++++++++++++++++++----- 1 file changed, 1061 insertions(+), 169 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 82d195a653..3f93793263 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -109,6 +109,13 @@ Template:echo {{{1}}} !! endarticle +// For Serbian; localize Template namespace +!! article +Шаблон:Echo +!! text +{{{1}}} +!! endarticle + !! article Template:echo_with_span !! text @@ -278,6 +285,12 @@ Template:CircularRef {{CircularRef}} !! endarticle +!! article +Template:With: Colon +!! text +Template with colon +!! endarticle + ### ### Basic tests ### @@ -1855,6 +1868,19 @@ parsoid=wt2html,wt2wt !! end +## Make sure ">" gets escaped in comments to avoid XSS +!! test +IE conditional comments +!! wikitext + +!! html/parsoid + +!! end + ### ### paragraph wrapping tests ### @@ -2818,7 +2844,7 @@ Templates: Handle comments in the target

foo

foo

-!!end +!! end !! test Templates: Handle comments in parameter names (T69657) @@ -2848,7 +2874,7 @@ Templates: Handle comments in parameter names (T69657)

foo

foo

-!!end +!! end !! test Templates: Other wikitext in parameter names (T69657) @@ -2859,11 +2885,23 @@ Templates: Other wikitext in parameter names (T69657)

!! html/parsoid

{{{1}}}

-!!end +!! end + +!! test +Templates: With colons +!! wikitext +{{With: Colon}} +!! html/php +

Template with colon +

+!! html/parsoid +

Template with colon

+!! end #-------------------------------------------------------------------- # Transclusion parameter escaping tests #-------------------------------------------------------------------- + !! test Templates: Parsoid parameter escaping test 1 !! wikitext @@ -7719,13 +7757,16 @@ Piped link with extlink-like text !! wikitext [[Main Page|[bar]]] [[Main Page|This is a [bar]]] +[[Main Page|[bar]] !! html/php

[bar] This is a [bar] +[bar

!! html/parsoid

[bar] -This is a [bar]

+This is a [bar] +[bar

!! end !! test @@ -8065,7 +8106,6 @@ Plain link to page with question mark in title

!! end - # I'm fairly sure the expected result here is wrong. # We want these to be URL links, not pseudo-pages with URLs for titles.... # However the current output is also pretty screwy. @@ -8088,6 +8128,34 @@ Piped link to URL: [[http://www.example.com|an example URL]]

Piped link to URL: [example URL]

!! end +!! test +Plain link in template argument +!! options +parsoid=wt2html +!! wikitext +{{echo|[http://www.example.com |123]}} + +{{echo|[[http://www.example.com |123]]}} + +{{echo|[[http://www.example.com |123]}} + +{{echo|[http://www.example.com |123]]}} +!! html/php +

[http://www.example.com +

[|123] +

{{echo|[|123}} +

[http://www.example.com +

+!! html/parsoid +

[http://www.example.com

+ +

[|123]

+ +

{{echo|[|123}}

+ +

[http://www.example.com

+!! end + !! test T2002: [[page|http://url/]] should link to page, not http://url/ !! wikitext @@ -8172,6 +8240,33 @@ Non-breaking spaces in title

!!end +# Add new article for the test below so that it doesn't red-link +!! article +Foo bar baz +!! text +boo +!! endarticle + +!! test +Multiple spaces in titles should normalize to a single underscore +!! options +parsoid=wt2html,wt2wt +!! wikitext +[[Foo bar baz|x]] +[[Foo bar baz|x]] +[[Foo bar baz|x]] +!! html/php +

x +x +x +

+!! html/parsoid +

x +x +x +

+!! end + !! test Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue) !! options @@ -8743,6 +8838,8 @@ Blah blah blah !! test Multiple colons escaping interlanguage links +!! options +parsoid=wt2html !! wikitext [[:es:Spanish]] [[::es:Spanish]] @@ -8752,6 +8849,10 @@ Multiple colons escaping interlanguage links [[::es:Spanish]] [[:::es:Spanish]]

+!! html/parsoid +

es:Spanish +[[::es:Spanish]] +[[:::es:Spanish]]

!! end ## parsoid html2wt will normalize the space to _ @@ -9155,8 +9256,6 @@ some text
  1. redirect Main Page
!! end -# FIXME: Should hoist the redirect to the top of the page and ensure there -# is only one. !! test New redirect !! options @@ -9164,7 +9263,53 @@ parsoid=html2wt !! html/parsoid

Foo

!! wikitext +#REDIRECT [[Foo]] Foo +!! end + +!! test +Redirect followed by block on the same line +!! options +parsoid=wt2html +!! wikitext +#REDIRECT [[Main Page]]== hi == +!! html/parsoid +

hi

+!! end + +!! test +Redirect followed by a newline +!! wikitext +#REDIRECT [[Main Page]] +A newline +!! html/parsoid + +

A newline

+!! end + +!! test +Redirect followed by multiple newlines +!! wikitext +#REDIRECT [[Main Page]] + + +A newline +!! html/parsoid + + +


+A newline

+!! end + +!! test +Drop duplicate redirects +!! options +parsoid=html2wt +!! html/parsoid + + + +!! wikitext #REDIRECT [[Foo]] !! end @@ -11892,6 +12037,8 @@ parsoid ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]] !! test Preprocessor precedence 1: link is rightmost opening +!! options +parsoid=wt2html !! wikitext {{[[Foo|bar}}]] @@ -11900,13 +12047,17 @@ But close-brace is not a valid character in a link title: However, we can still tell this was handled as a link in the preprocessor: {{echo|[[Foo}}|bar]]|bat}} -!! html +!! html/php

{{bar}}

But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]

However, we can still tell this was handled as a link in the preprocessor: [[Foo}}|bar]]

+!! html/parsoid +

{{bar}}

+

But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]

+

However, we can still tell this was handled as a link in the preprocessor: [[Foo}}|bar]]

!! end !! test @@ -11915,26 +12066,33 @@ Preprocessor precedence 2: template is rightmost opening language=zh !! wikitext -{{echo|foo}-}}- -!! html +!! html/php

-foo}--

+!! html/parsoid +

-foo}--

!! end !! test Preprocessor precedence 3: language converter is rightmost opening !! options language=zh +parsoid=wt2html !! wikitext {{echo|hi}} {{-{R|echo|hi}}}- [[-{R|raw]]}- -!! html +!! html/php

hi

{{echo|hi}}

[[raw]]

+!! html/parsoid +

hi

+

{{

+

[[

!! end !! test @@ -11943,7 +12101,9 @@ Preprocessor precedence 4: left-most angle bracket language=zh !! wikitext -!! html +!! html/php +!! html/parsoid + !! end !! article @@ -11956,21 +12116,28 @@ Template:Precedence5 Preprocessor precedence 5: tplarg takes precedence over template !! wikitext {{Precedence5|Bullet}} -!! html +!! html/php +!! html/parsoid + !! end !! test Preprocessor precedence 6: broken link is rightmost opening +!! options +parsoid=wt2html !! wikitext {{echo|[[Foo}} {{echo|[[Foo|bar|bat=baz}} -!! html +!! html/php

{{echo|[[Foo}}

{{echo|[[Foo|bar|bat=baz}}

+!! html/parsoid +

{{echo|[[Foo}}

+

{{echo|[[Foo|bar|bat=baz}}

!! end # This next test exposes a difference between PHP and Parsoid: @@ -11995,6 +12162,8 @@ Preprocessor precedence 6: broken link is rightmost opening !! test Preprocessor precedence 7: broken template is rightmost opening +!! options +parsoid=wt2html !! wikitext [[Foo|{{echo|Bar]] @@ -12002,12 +12171,17 @@ Preprocessor precedence 7: broken template is rightmost opening Careful: linktrails can move the end of the wikilink: [[Foo|{{echo|y']]a}}l]]l -!! html +!! html/php

{{echo|Bar

Bar-x-y]]-z

Careful: linktrails can move the end of the wikilink: y'al]]l

+!! html/parsoid +

[[Foo|{{echo|Bar]]

+

Bar]]-x-y-z

+

Careful: linktrails can move the end of the wikilink: +y']]all

!! end !! test @@ -12034,7 +12208,7 @@ Template:Preprocessor_precedence_9 Preprocessor precedence 9: groups of braces !! wikitext {{Preprocessor precedence 9|Four|Bullet|1|2}} -!! html +!! html/php
4
{Four}
5
@@ -12045,6 +12219,20 @@ Preprocessor precedence 9: groups of braces
7
{Bullet}
+!! html/parsoid +
+
4
+
{Four}
+
5
+
+
+
6
+
Four
+
7
+
{Bullet}
+
!! end !! article @@ -12065,7 +12253,7 @@ Preprocessor precedence 10: groups of braces with leading dash language=zh !! wikitext {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}} -!! html +!! html/php
1
raw
2
@@ -12083,6 +12271,29 @@ language=zh
7
raw2
+!! html/parsoid +
+
1
+
+
2
+
-
+
+
3
+
-Three-
+
4
+
+
5
+
-
+
+
6
+
-Three-
+
7
+
+
!! end !! test @@ -12093,15 +12304,23 @@ Preprocessor precedence 11: found during visual diff testing {{echo|-{{echo|-{{echo|x}}}}}} {{echo|-{{echo|x}}}} -!! html +!! html/php

--x

--x

-x

+!! html/parsoid +

--x

+ +

--x

+ +

-x

!! end !! test Preprocessor precedence 12: broken language converter closed by brace. +!! options +parsoid=wt2html !! wikitext This form breaks the template, which is unfortunate: * {{echo|foo-{bar}bat}} @@ -12116,7 +12335,7 @@ tag, nothing bad happens: foo-{bar}bat {{echo|foo-{bar}bat}} -!! html+tidy +!! html/php+tidy

This form breaks the template, which is unfortunate:

!! html/parsoid -