From 121962101f692e1651714bb8de0cfc6ca78a636e Mon Sep 17 00:00:00 2001
From: "C. Scott Ananian"
Date: Wed, 25 Jan 2017 12:50:52 -0500
Subject: [PATCH] Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 643d5392bcf4dfebf906102627c51e8a608125bf
Change-Id: I4d7dc7378ca7cfdb3919f33959f58eb5c4d88ca8
---
tests/parser/parserTests.txt | 340 ++++++++++++++++++-----------------
1 file changed, 176 insertions(+), 164 deletions(-)
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index ed09203434..983c1723e0 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -933,6 +933,7 @@ Italics and bold: 5-quote opening sequence: (5,6)
###
### multiple quote sequences in a line
###
+
!! test
Italics and bold: multiple quote sequences: (2,4,2)
!! options
@@ -942,8 +943,7 @@ parsoid=wt2html
!! html/*
foo'bar
-!!end
-
+!! end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
@@ -955,7 +955,6 @@ Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
!! end
-
!! test
Italics and bold: multiple quote sequences: (2,4,3)
!! options
@@ -965,8 +964,7 @@ parsoid=wt2html
!! html/*
foo'bar
-!!end
-
+!! end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
@@ -978,7 +976,6 @@ Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
!! end
-
!! test
Italics and bold: multiple quote sequences: (2,4,4)
!! options
@@ -988,8 +985,7 @@ parsoid=wt2html
!! html/*
foo'bar'
-!!end
-
+!! end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
@@ -1001,7 +997,6 @@ Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
!! end
-
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
Italics and bold: multiple quote sequences: (3,4,2)
@@ -1015,24 +1010,21 @@ parsoid=wt2html
!! html/parsoid
foo'bar
-!!end
+!! end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
-!! options
-parsoid
!! wikitext
-'''foo''''bar''''
+'''foo''''bar''''
!! html/php
foo'bar
!! html/parsoid
-
foo'bar
+
foo'bar
!! end
-
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
Italics and bold: multiple quote sequences: (3,4,3)
@@ -1046,18 +1038,18 @@ parsoid=wt2html
!! html/parsoid
foo'bar
-!!end
+!! end
# same html as previous, but wikitext adjusted to match parsoid html2wt
!! test
Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
!! wikitext
-'''foo''''bar''''''
+'''foo''''bar''''''
!! html/php
foo'bar
!! html/parsoid
-
foo'bar
+
foo'bar
!! end
@@ -1135,7 +1127,7 @@ The ''[[Main Page]]'''s talk page.
+data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a|b"}},"i":0}}]}'>http://foo.com/a%7Cb
!! end
!! test
@@ -4798,6 +4790,17 @@ news:'a'b''c''d e
+!! end
+
!! test
Link containing double-single-quotes '' in text (bug 4598 sanity check)
!! wikitext
@@ -7849,7 +7863,7 @@ Some [[Link|pretty ''italics'' and stuff]]!
!! end
!! test
@@ -8180,12 +8194,10 @@ title=[[User:test/123]]
!! test
1. Interaction of linktrail and template encapsulation
-!! options
-parsoid
!! wikitext
{{echo|[[Foo]]}}l
-!! html
-
!! wikitext
Aðrir mótmælenda[[söfnuður]]
!! end
@@ -8291,12 +8303,10 @@ Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
!! test
Parsoid: Scoped parsing should handle mixed transclusions and plain text
-!! options
-parsoid
!! wikitext
[[Foo|{{echo|a}} b {{echo|c}}]]
-!! html
-
!! wikitext
He llo [[Foo|He llo]]
@@ -10361,7 +10371,7 @@ Parsoid: Page property magic word with magic word contents
!! wikitext
{{DISPLAYTITLE:''{{PAGENAME}}''}}
!! html/parsoid
-
+
!! end
!! test
@@ -13577,7 +13587,7 @@ Image with link parameter, wiki target
!! html/parsoid
-
+
!! end
# parsoid bug 49293 (part 1)
@@ -13684,7 +13694,7 @@ Image with link parameter (wiki target) and unnamed parameter
!! html/parsoid
-
+
!! end
!! test
@@ -13736,7 +13746,7 @@ parsoid=wt2html,wt2wt,html2html
Title
!! html/parsoid
-
+
!! end
!! test
@@ -13778,7 +13788,7 @@ parsoid=wt2html,wt2wt,html2html
Title
!! html/parsoid
-
+
!! end
!! test
@@ -13791,7 +13801,7 @@ parsoid=wt2html,wt2wt,html2html
!! end
!! test
@@ -15046,12 +15056,12 @@ Bar
Bar
!! html/parsoid
-
Foo Bar
-
Foo Bar
-
Foo Bar
-
Foo Bar
-
Foo Bar
-
+
Foo Bar
+
Foo Bar
+
Foo Bar
+
Foo Bar
+
Foo Bar
+
!! end
## We used to, but no longer wt2wt this test since the default serializer
@@ -16523,9 +16533,11 @@ Template:Div style
Bug 2304: HTML attribute safety (safe template; regression bug 2309)
!! wikitext
-!! html
+!! html/php
+!! html/parsoid
+
!! end
# Parsoid has enough context to handle this case
@@ -16544,29 +16556,36 @@ Bug 2304: HTML attribute safety (dangerous template; 2309)
Bug 2304: HTML attribute safety (dangerous style template; 2309)
!! wikitext
-!! html
+!! html/php
+!! html/parsoid
+
!! end
!! test
Bug 2304: HTML attribute safety (safe parameter; 2309)
!! wikitext
{{div style|width: 200px}}
-!! html
+!! html/php
Magic div
+!! html/parsoid
+
Magic div
!! end
!! test
Bug 2304: HTML attribute safety (unsafe parameter; 2309)
!! wikitext
{{div style|width: expression(alert(document.cookie))}}
-!! html
+!! html/php
Magic div
+!! html/parsoid
+
Magic div
!! end
+## Parsoid output here differs; needs investigation.
!! test
Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
!! wikitext
@@ -16576,6 +16595,7 @@ Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
!! end
+## Parsoid output here differs; needs investigation.
!! test
Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
!! wikitext
@@ -16612,7 +16632,6 @@ Bug 2304: HTML attribute safety (bold)
!! end
-
!! test
Bug 2304: HTML attribute safety (ISBN)
!! wikitext
@@ -16662,18 +16681,22 @@ Bug 2304: HTML attribute safety (named web link)
Bug 3244: HTML attribute safety (extension; safe)
!! wikitext
-!! html
+!! html/php
+!! html/parsoid
+
!! end
!! test
Bug 3244: HTML attribute safety (extension; unsafe)
!! wikitext
-!! html
+!! html/php
+!! html/parsoid
+
!! end
# More MSIE fun discovered by Tom Gilder
@@ -16682,45 +16705,55 @@ Bug 3244: HTML attribute safety (extension; unsafe)
MSIE CSS safety test: spurious slash
!! wikitext
evil
-!! html
+!! html/php
evil
+!! html/parsoid
+
evil
!! end
!! test
MSIE CSS safety test: hex code
!! wikitext
evil
-!! html
+!! html/php
evil
+!! html/parsoid
+
evil
!! end
!! test
MSIE CSS safety test: comment in url
!! wikitext
evil
-!! html
+!! html/php
evil
+!! html/parsoid
+
evil
!! end
!! test
MSIE CSS safety test: comment in expression
!! wikitext
evil4
-!! html
+!! html/php
evil4
+!! html/parsoid
+
evil4
!! end
!! test
CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
!! wikitext
A
-!! html
+!! html/php
A
+!! html/parsoid
+
A
!! end
!! test
@@ -16728,10 +16761,13 @@ MSIE 6 CSS safety test: Fullwidth (bug 55332)
!! wikitext
A
B
-!! html
+!! html/php
A
B
+!! html/parsoid
+
A
+
B
!! end
!! test
@@ -16739,10 +16775,13 @@ MSIE 6 CSS safety test: IPA extensions (bug 55332)
!! wikitext
A
B
-!! html
+!! html/php
A
B
+!! html/parsoid
+
A
+
B
!! end
!! test
@@ -16751,23 +16790,30 @@ MSIE 6 CSS safety test: sup/sub script (bug 55332)
A
B
C
-!! html
+!! html/php
A
B
C
+!! html/parsoid
+
A
+
B
+
C
!! end
-# FIXME: Parsoid fails to sanitize this! See T58846.
!! test
Opera -o-link CSS
+!! options
+parsoid=wt2html,html2html
!! wikitext
X
-!! html
+!! html/php
X
+!! html/parsoid
+
X
!! end
!! test
@@ -16780,7 +16826,7 @@ MSIE 6 CSS safety test: Repetition markers (bug 55332)
!! end
!! test
@@ -16852,7 +16906,6 @@ Expansion of multi-line templates in attribute values (bug 6255)
!! end
-
!! test
Expansion of multi-line templates in attribute values (bug 6255 sanity check)
!! wikitext
@@ -16886,6 +16939,7 @@ Tags which are hidden from Tidy cannot pass through the Sanitizer
###
### Parser hooks (see tests/parser/parserTestsParserHook.php for the extension)
###
+
!! test
Parser hook: empty input
!! wikitext
@@ -18856,7 +18910,6 @@ stuff
xxx
!! end
-
!! test
Handling of
in URLs
!! wikitext
@@ -18865,9 +18918,7 @@ Handling of
in URLs
!! end
-
# The PHP parser strips the empty tags out for giggles; parsoid doesn't.
!! test
5 quotes, code coverage +1 line
@@ -19452,6 +19502,27 @@ File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
!! end
+!! test
+Gallery override link with absolute external link with LanguageConverter
+!! options
+language=zh
+!! input
+
+File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
+
+!! result
+
+
+
+
+
caption
+
+
+
+
+
+!! end
+
!! test
Gallery override link with malicious javascript (T36852)
!! options
@@ -19474,7 +19545,7 @@ File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!
!! html/parsoid
-
+
!! end
@@ -19504,6 +19575,24 @@ File:Foobar.jpg|link=<
!! end
+!! test
+Serialize gallery without attrs in data-mw
+!! options
+parsoid={
+ "modes": ["html2wt"],
+ "nativeGallery": true
+}
+!! html/parsoid
+
+
123
+
File:Test.png
+
+!! wikitext
+
+File:Test.png
+
+!! end
+
!! test
HTML Hex character encoding (spells the word "JavaScript")
!! options
@@ -19787,7 +19876,6 @@ dt/dd/dl test
!!end
-
# Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "" tag.
!! test
Images with the "|" character in the comment
@@ -19797,7 +19885,7 @@ Images with the "|" character in the comment
+
!! end
!! test
@@ -22384,82 +22472,6 @@ File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
!! end
-!!test
-Gallery override link with absolute external link (bug 34852)
-!! wikitext
-
-File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
-
-!! html
-
-
-
-
-
caption
-
-
-
-
-
-!! end
-
-!! test
-Gallery override link with absolute external link with LanguageConverter
-!! options
-language=zh
-!! input
-
-File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
-
-!! result
-
-
-
-
-
caption
-
-
-
-
-
-!! end
-
-!!test
-Gallery override link with malicious javascript (bug 34852)
-!! wikitext
-
-File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
-
-!! html
-
-
-
-
-
caption
-
-
-
-
-
-!! end
-
-!!test
-Gallery with invalid title as link (bug 43964)
-!! wikitext
-
-File:foobar.jpg|link=<
-
-!! html
-
-
-
-
-
-
-
-
-!! end
-
!!test
Language parser function
!! wikitext
@@ -22721,7 +22733,7 @@ A