From f52f3db6539ddde6f8c74165efc292a1121486b7 Mon Sep 17 00:00:00 2001
From: Subramanya Sastry
Date: Thu, 2 Jan 2014 15:01:32 -0600
Subject: [PATCH] Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 97bb35b73a4e4779b9be0bf2aedc351f539b0a0d
Change-Id: Id9e18cd6f33c6f71d0dfb57bd854a98d81b5ad84
---
tests/parser/parserTests.txt | 779 +++++++++++++++++++++++++++++++----
1 file changed, 689 insertions(+), 90 deletions(-)
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index cc935da8f0..ce2c73406a 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -146,6 +146,12 @@ Template:Bullet
* Bar
!!endarticle
+!!article
+Template:OpenTable
+!!text
+{|
+!!endarticle
+
###
### Basic tests
###
@@ -916,27 +922,36 @@ Non-html5 tags should be accepted
!! test
Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
!! input
- doesn't work!
-
- doesn't work!
+ doesn't work!
- works fine
+ doesn't work!
-foo
+ works fine s.foo
!! result
-
<bâ> doesn't work! </b>
-
<bä> doesn't work! </b>
-
<boo> works fine </b>
-
<s.foo>foo</s>
+
<bâ> doesn't work! </bâ>
+
<bä> doesn't work! </bä>
+
<boo> works fine </boo>
<s.foo>s.foo</s.foo>
<sub-ID#1>
!! end
+!! test
+Isolated close tags should be treated as literal text (bug 52760)
+!! input
+
+
+s
+!! result
+
</b>
+
<s.foo>s</s>
+
+!! end
+
###
### Special characters
###
@@ -1336,6 +1351,22 @@ b
!! end
+## PHP parser emits output which is broken
+!! test
+Unclosed HTML p-tags should be handled properly
+!! options
+parsoid
+!! input
+
foo
+a
+
+b
+!! result
+
foo
+
a
+
b
+!! end
+
###
### Preformatted text
###
@@ -1589,6 +1620,46 @@ Entities inside
!! end
+!! test
+Empty pre; pre inside other HTML tags (bug 54946)
+!! input
+a
+
+
+foo
+
+
+!! result
+
a
+
+
+foo
+
+
+
+!! end
+
+!! test
+HTML pre followed by indent-pre
+!! input
+
foo
+ bar
+!! result
+
foo
+
bar
+
+!! end
+
+!!test
+Block tag pre
+!!options
+parsoid
+!!input
+
foo
+!!result
+
foo
+!!end
+
!!test
Templates: Indent-Pre: 1a. Templates that break a line should suppress
!!input
@@ -1708,6 +1779,25 @@ Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
!!end
+!! test
+Things that look like
tags aren't treated as such
+!! input
+Barack Obama of the United States
+!! result
+
Barack Obama <President> of the United States
+
+!! end
+
+!! test
+Parsoid: handle pre with space after attribute
+!! options
+parsoid=wt2html
+!! input
+
{{echo|foo}}
+!! result
+
{{echo|foo}}
+!! end
+
# TODO / maybe: fix wt2wt for this
!! test
Parsoid: Don't paragraph-wrap fosterable content
@@ -1928,6 +2018,17 @@ parsoid=html2wt,wt2wt
bar
!! end
+## Bug 56733
+!! test
+Templates parameters with special tokenizing behavior dont get modified because of arg escaping
+!! options
+parsoid
+!! input
+{{echo|a : b}}
+!! result
+
a : b
+!! end
+
###
### Parsoid-centric tests for testing RT edge cases for pre
###
@@ -2042,18 +2143,30 @@ c
!!test
3a. Indent-Pre and block tags (single-line html)
!!input
-
foo
-
foo
-
foo
+ a
foo
+ b
foo
+ c
foo
foo
!!result
-
foo
-
foo
-
foo
+ a
foo
+ b
foo
+ c
foo
foo
!!end
+!!test
+3c. Indent-Pre and block tags (multi-line html)
+!!input
+ a foo
+ b
foo
+!!result
+
a foo
+
+ b
foo
+
+!!end
+
!!test
3b. Indent-Pre and block tags (pre-content on separate line)
!!input
@@ -2137,11 +2250,11 @@ foo
!!end
+## NOTE: the leading white-space chars on empty line are significant
!! test
-5. White-space in indent-pre
-NOTE: the white-space char on 2nd line is significant
+5a. White-space in indent-pre
!! input
- a
+ a
b
!! result
@@ -2151,6 +2264,39 @@ b
!! end
+## NOTE: the leading white-space chars on empty line are significant
+!! test
+5b. White-space in indent-pre
+!! input
+ a
+
+ b
+
+
+ c
+!! result
+
a
+
+b
+
+
+c
+
+!! end
+
+!! test
+5c. White-space in indent-pre
+!! input
+ ''a''
+ ''b''
+ ''c''
+!! result
+
a
+ b
+ c
+
+!! end
+
!! test
6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
!! input
@@ -3935,6 +4081,83 @@ http://example.com
+!! end
+
+!! test
+Parenthesis in external links, w/ transclusion or comment
+!! options
+parsoid
+!! input
+(http://example.com/{{echo|hi}})
+
+(http://example.com)
+!! result
+
+!! end
+
###
### Quotes
###
@@ -4048,16 +4271,71 @@ php
!! input
{||}
!! result
+
!! end
+
# Parsoid team replies: empty table tags are legal in HTML5
!! test
A table with no data. (parsoid)
!! options
-parsoid
+parsoid=wt2html
!! input
{||}
!! result
+
+!! end
+
+!! test
+A table with stray table end tags on start tag line (wt2html)
+!! options
+parsoid=wt2html
+!! input
+{|style="color: red;"|}
+
+{|style="color: red;" |}
+|foo
+|}
+
+{|style="color: red;"|} id="foo"
+|foo
+|}
+
+{|style="color: red;" |} id="foo"
+|foo
+|}
+!! result
+
+
+
+
+
foo
+
+
+
+
+
+
foo
+
+
+
+
+
+
foo
+
+
+
+!! end
+
+!! test
+A table with no data (take 2) (parsoid)
+!! options
+parsoid
+!! input
+{|
+|}
+!! result
+
!! end
# A table with nothing but a caption is invalid XHTML, we might want to render
@@ -4757,6 +5035,18 @@ parsoid=html2wt
baz
quux
!! end
+!! test
+Parsoid: newline inducing block nodes don't suppress
+!! options
+parsoid=html2wt
+!! input
+a
+
+= foo =
+!! result
+ a
foo
+!! end
+
###
### Internal links
###
@@ -4899,6 +5189,17 @@ Piped link with 3 brackets
!! end
+!! test
+Piped link with extlink-like text
+!! input
+[[Main Page|[bar]]]
+[[Main Page|This is a [bar]]]
+!! result
+
!! end
+!! test
+Interwiki links that cannot be represented in wiki syntax
+!! options
+parsoid
+!! input
+[[meatball:ok]]
+[[meatball:ok#foo|ok with fragment]]
+[[meatball:ok_as_well?|ok ending with ? mark]]
+[http://de.wikipedia.org/wiki/Foo?action=history has query]
+[http://de.wikipedia.org/wiki/#foo is just fragment]
+
+!! result
+
+
+!!end
+
###
### Testing parsing of templates where a template arg
### has the same name as the template itself.
@@ -9393,6 +9737,36 @@ parsoid
!! end
+!! test
+Image with caption, bug 53312 #1 (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|right|Caption page stuff]]
+!! result
+
+!! end
+
+!! test
+Image with caption, bug 53312 #2 (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|right|Caption page=]]
+!! result
+
+!! end
+
+!! test
+Image with caption, bug 53312 #3 (parsoid)
+!! options
+parsoid
+!! input
+[[File:Foobar.jpg|right|Caption page=stuff]]
+!! result
+
+!! end
+
!! test
Image with empty attribute (php)
!! options
@@ -9840,9 +10214,9 @@ Thumbnail image caption with a free URL and explicit alt
SVG thumbnails with no language set
!! options
!! input
-[[File:Foobar.svg|thumb|width=200]]
+[[File:Foobar.svg|thumb|caption]]
!! result
-
width=200
+
caption
!! end
@@ -9850,9 +10224,9 @@ SVG thumbnails with no language set
SVG thumbnails with language de
!! options
!! input
-[[File:Foobar.svg|thumb|width=200|lang=de]]
+[[File:Foobar.svg|thumb|caption|lang=de]]
!! result
-
width=200
+
caption
!! end
@@ -9860,7 +10234,7 @@ SVG thumbnails with language de
SVG thumbnails with invalid language code
!! options
!! input
-[[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
+[[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
!! result
lang=invalid.language.code
@@ -10208,22 +10582,22 @@ parsoid
#
!! test
-Caption with a template in it
+Parsoid-specific image handling - caption with a template in it
!! options
parsoid
!! input
-[[Image:Foobar.jpg|thumb|200px|This caption has a {{echo|transclusion}} in it.]]
+[[File:Foobar.jpg|thumb|200x200px|This caption has a {{echo|transclusion}} in it.]]
!! result
!! end
!! test
-Caption with unbalanced tags in it
+Parsoid-specific image handling - caption with unbalanced tags in it
!! options
-parsoid
+parsoid=wt2html,wt2wt,html2html
!! input
foo
-[[Image:Foobar.jpg|thumb|200px|This caption has a
unbalanced tag in it.]]
+[[File:Foobar.jpg|thumb|200x200px|This caption has a
unbalanced tag in it.]]
bar
!! result
foo
@@ -10531,6 +10905,16 @@ parsoid
!! end
+!! test
+Parsoid: Defaultsort
+!! options
+parsoid
+!! input
+{{DEFAULTSORT:Foo}}
+!! result
+
+!! end
+
###
### Inter-language links
###
@@ -11241,6 +11625,29 @@ I always thought &xacute; was a cute letter.
!! end
+# TODO: generalize to PHP parser?
+!! test
+HTML5 tags
+!! options
+parsoid
+!! input
+five
+
+This highlighted text
+!! result
+
five
+
+This highlighted text
+!! end
+
+!! test
+HTML tag with leading space is parsed as text
+!! input
+< div>foo< /div>
+!! result
+
< div>foo< /div>
+
+!! end
###
### Nesting tests (see bug 41545, 50604, 51081)
@@ -16799,6 +17206,22 @@ B1 and tags
+!!options
+parsoid=wt2html
+!!input
+A foo
+
+
+!!result
+
+!!end
+
!!test
References: 1. references tag without any refs should be handled properly
!!options
@@ -16817,7 +17240,7 @@ parsoid
A foo
B bar
-
+
!!result
!!end
!! test
@@ -17482,14 +17918,18 @@ Tables: 1d. No escaping needed
!! test
Tables: 2a. Nested in td
!! options
-parsoid
+parsoid=html2wt
!! input
{|
|foo|bar
+|-
+|x
a|b
|}
!! result
-
foo|bar
+
foo|bar
+
x
a|b
+
!! end
!! test
@@ -17612,6 +18052,9 @@ parsoid
bar|baz
+bar
-bar
+|-
+|x
+
a|b
|}
!! result
@@ -17621,32 +18064,27 @@ bar|baz
bar|baz
+bar
-bar
+
x
+
a|b
!! end
-### SSS FIXME: Disabled right now because accurate html2wt
-### on this snippet requires data-parsoid flags that we've
-### stripped out of these tests. We should scheme how we
-### we want to handle these kind of tests that require
-### data-parsoid flags for accurate html2wt serialization
-
!! test
Tables: 4d. No escaping needed
!! options
-disabled
+parsoid
!! input
{|
+|[[Foo]]-bar
||+1
||-2
|}
!! result
+fools' errand
+fool's errand
!! end
!! test
@@ -17901,6 +18350,7 @@ __|__
#### 1. a tags
#### 2. other tags
#### 3. multi-line html tag
+#### 4. extension tags
#### -----------------------------------------
!! test
1. a tags
@@ -17940,8 +18390,14 @@ parsoid
4. extension tags
!! input
foo
+
+bar
+
+baz
!! result
<ref>foo</ref>
+
<ref>bar
+
baz</ref>
!! end
@@ -18531,6 +18987,26 @@ parsoid=wt2wt,wt2html
b
!!end
+!!test
+Table in fosterable position
+!!options
+parsoid=wt2html,wt2wt
+!!input
+{{OpenTable}}
+
+{|
+|}
+
+|}
+!!result
+
+
+
+
+
+
+!!end
+
# -----------------------------------------------------------------
# The following section of tests are primarily to spec requirements
# around serialization of new/edited content.
@@ -18560,16 +19036,11 @@ parsoid=html2wt
123
456
!!end
-# Wacky -- the leading newline in input is required because
-# that is what the serializer emits. To be fixed. Not fixing
-# the test because this test is required to test serialization of
-# new content and preferred whitespace style.
!! test
Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
!! options
parsoid=html2wt
!! input
-
* foo
!! result
@@ -18577,6 +19048,16 @@ parsoid=html2wt
!! end
+!! test
+Lists: Serialize correctly even when list tags has unneeded whitespace between tags
+!! options
+parsoid=html2wt
+!! input
+* foo
+!! result
+
foo
+!! end
+
!! test
Don't strip leading whitespace when handling indent-pre suppressing tags
!! options
@@ -18623,6 +19104,10 @@ foo
foo
bar
+
+
+foo
+
!! result
foo
bar
@@ -18632,18 +19117,17 @@ foo
foo
bar
+
+
+ foo
+
!! end
-# Wacky -- the leading newline in input is required because
-# that is what the serializer emits. To be fixed. Not fixing
-# the test because this test is required to test serialization of
-# new content and preferred whitespace style.
!! test
Lists: Add space after bullets
!! options
parsoid=html2wt
!! input
-
* foo
* bar
* baz
@@ -18655,6 +19139,25 @@ parsoid=html2wt
!! end
+!! test
+Headings: Add space before/after == (Bug 51744)
+!! options
+parsoid=html2wt
+!! input
+== foo ==
+
+== bar ==
+
+== baz ==
+
+== baz ==
+!! result
+
foo
+
bar
+
baz
+
baz
+!! end
+
!! test
Parsoid: Serialize positional parameters with = in them as named parameter
!! options
@@ -18781,8 +19284,12 @@ parsoid=html2wt
AB
!! end
+#------------------------------------
+# End of I/B quote minimization tests
+#------------------------------------
+
!!test
-5. Bug 54262: New entities
+Bug 54262: New entities
!! options
parsoid=html2wt
!! input
@@ -18791,6 +19298,98 @@ foo
foo
!! end
+## Note that there is no wikitext output for 'unknownproperty' ##
+## Unknown magic words are silently dropped ##
+
+!! test
+Magic words
+!! options
+parsoid=html2wt
+!! input
+__TOC__
+__NOTOC__
+__FORCETOC__
+__INDEX__
+__NOINDEX__
+__NOGALLERY__
+__NOEDITSECTION__
+__NOTITLECONVERT__
+__NOCONTENTCONVERT__
+!! result
+
+
+
+
+
+
+
+
+
+
+!! end
+
+!! test
+Consecutive
s should not get merged
+!! options
+parsoid=html2wt,html2html
+!! input
+ a
+
+ b
+
+ c
+
+ d
+
+ e
+
+
+
+ f
+!! result
+
a
b
+
+
c
+
+d
+
+
e
+
+
+
+f
+!! end
+
+!! test
+Edited ISBN links not serializable as ISBN links should serialize as wikilinks
+!! options
+parsoid=html2wt
+!! input
+[[Special:BookSources/1234567890|ISBN 1234567895]]
+!! result
+ISBN 1234567895
+!! end
+
+!! test
+Edited RFC links not serializable as RFC links should serialize as extlinks
+!! options
+parsoid=html2wt
+!! input
+[//tools.ietf.org/html/rfc123 New RFC]
+!! result
+New RFC
+!! end
+
+!! test
+Edited PMID links not serializable as PMID links should serialize as extlinks
+!! options
+parsoid=html2wt
+!! input
+[//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
+!! result
+New PMID
+!! end
+
# -----------------------------------------------------------------
# End of section for Parsoid-only html2wt tests for serialization
# of new content
--
2.20.1