From 52363db5666b0af739a5cbf3d5a9c715e0f8ba11 Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Wed, 24 Aug 2016 11:40:58 -0500 Subject: [PATCH] Sync up with Parsoid parserTests. This now aligns with Parsoid commit 47e085881094299aa652320aba1dfb5b99855690 Change-Id: I2da551dc9d8568c56decbabcad8bcf8d57680b47 --- tests/parser/parserTests.txt | 218 +++++++++++++++++++++++++---------- 1 file changed, 157 insertions(+), 61 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index d6d2b29976..f308b8ed59 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -2824,7 +2824,7 @@ parsoid !! wikitext {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}} !! html -

[Main_Page bar]

+

[Main Page bar]

!! end !! test @@ -3173,58 +3173,19 @@ foo !!end -!!test +!! test 4. Indent-Pre and extension tags !! wikitext - a -File:foobar.jpg - -!! html - a - -!! html+tidy -

a

- -!!end + a +!! html/php + a
+NULL
+array (
+)
+
-!! test -Table wikitext syntax outside wiki-tables -!! wikitext -a -! not a table heading -|- not a table row -| not a table cell -| class="foo bar" | baz -b -|} -|- -c -!! html -

a -! not a table heading -|- not a table row -| not a table cell -| class="foo bar" | baz -b -|} -|- -c -

+!! html/parsoid + a

 !! end
 
 !!test
@@ -4865,13 +4826,20 @@ And again with mixed protocols: [ftp://example.com?url=http://example.com link]
 

!!end +# Since Parsoid is starting to emit canonical wikitext for links, +# [http://example.com http://example.com] will not RT back to that +# form anymore. !! test External links: URL in text +!! options +parsoid=wt2html !! wikitext URL in text: [http://example.com http://example.com] -!! html +!! html/php

URL in text: http://example.com

+!! html/parsoid +

URL in text: http://example.com

!! end !! test @@ -7619,11 +7587,14 @@ Just a test of an article title containing a percent. Link containing % (not as a hex sequence) !! wikitext [[7% Solution]] +[[7% Solution|7%25 Solution]] !! html/php

7% Solution +7%25 Solution

!! html/parsoid -

7% Solution

+

7% Solution +7%25 Solution

!! end # note that the parsoid HTML is identical to the previous test output, @@ -7635,11 +7606,14 @@ Link containing % as a single hex sequence interpreted to char parsoid=wt2wt,wt2html,html2html !! wikitext [[7%25 Solution]] +[[7%25 Solution|7%25 Solution]] !! html/php

7% Solution +7%25 Solution

!! html/parsoid -

7% Solution

+

7% Solution +7%25 Solution

!!end !! test @@ -8004,6 +7978,28 @@ Link with multiple ":" in a subpage-supporting namespace (bug 63636)

Test

!! end +## Mainly a sanity check for Parsoid +!! test +Handle title parsing for subpages +!! options +title=[[/123123]] +!! wikitext +123 +!! html/parsoid +

123

+!! end + +## FIXME: Add a working php section here +!! test +Link to a subpage from a namespace other than main +!! options +title=[[User:test]] +!! wikitext +[[/123]] +!! html/parsoid +

/123

+!! end + !! test Purely hash wikilink !! options @@ -8515,18 +8511,25 @@ language=ln !! test Parsoid bug 53221: Wikilinks should be properly entity-escaped !! options -parsoid=html2wt +parsoid={ "modes": ["html2wt"], "suppressErrors": true } !! html/parsoid

He llo He llo

He llo He llo

!! wikitext He llo [[Foo|He llo]] -He llo [[He llo]] +He llo He llo +!! html/php +

He llo He llo +

He llo He llo +

!! end +# html2wt will fail because of title normalization without data-parsoid !! test Parsoid: handle constructor well +!! options +parsoid=wt2html,wt2wt !! wikitext [[constructor]] @@ -8536,9 +8539,9 @@ Parsoid: handle constructor well

constructor:foo

!! html/parsoid -

constructor

+

constructor

-

constructor:foo

+

constructor:foo

!! end !! article @@ -10140,7 +10143,7 @@ Parsoid: Page property magic word with magic word contents !! wikitext {{DISPLAYTITLE:''{{PAGENAME}}''}} !! html/parsoid - + !! end !! test @@ -10970,7 +10973,7 @@ foo {{''}} baz

foo bar baz

!! html/parsoid -

foo bar baz +

foo bar baz

!! end @@ -11444,6 +11447,33 @@ parsoid=wt2html !!end +!! test +Table wikitext syntax outside wiki-tables +!! wikitext +a +|+ not a caption +! not a table heading +|- not a table row +| not a table cell +| class="foo bar" | baz +b +|} +|- +c +!! html +

a +|+ not a caption +! not a table heading +|- not a table row +| not a table cell +| class="foo bar" | baz +b +|} +|- +c +

+!! end + ### ### Testing parsing of templates where a template arg ### has the same name as the template itself. @@ -13955,6 +13985,17 @@ Escape HTML special chars in image alt text

!! end +!! test +Entities in file name and attributes +!! wikitext +[[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]] +!! html/php +

7% solution +

+!! html/parsoid +

+!! end + !! test BUG 499: Alt text should have Ӓ, not &1234; !! wikitext @@ -14920,6 +14961,14 @@ parsoid=wt2html !! end +!! test +Category links with multiple namespaces +!! wikitext +[[Category:Project:Foo]] +!! html/parsoid + +!! end + !! test Parsoid: Serialize link to category page with colon escape !! options @@ -19329,10 +19378,14 @@ subpage title=[[Subpage test/L1/L2]]

!! end +# This is wt2html only in Parsoid because we add +# because of {{..}} and we don't expect to fix that to +# eliminate the nowikis selective for {{..}} markup. !! test Non-transclusion because of too many up levels !! options subpage title=[[Subpage test/L1/L2/L3]] +parsoid=wt2html !! wikitext {{../../../../More than parent}} !! html @@ -20036,10 +20089,14 @@ Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiw

!! end +# Since Parsoid is starting to emit canonical wikitext for links, +# [http://example.com http://example.com] will not RT back to that +# form anymore. !! test Proper conversion of text in external links !! options language=sr variant=sr-ec +parsoid=wt2html !! wikitext http://www.google.com gopher://www.google.com @@ -20048,7 +20105,7 @@ gopher://www.google.com [https://www.google.com irc://www.google.com] [ftp://www.google.com www.google.com/ftp://dir] [//www.google.com www.google.com] -!! html +!! html/php

http://www.google.com gopher://www.google.com http://www.google.com @@ -20057,6 +20114,14 @@ gopher://www.google.com www.гоогле.цом/фтп://дир www.гоогле.цом

+!! html/parsoid +

http://www.google.com +gopher://www.google.com +http://www.google.com +gopher://www.google.com +irc://www.google.com +www.гоогле.цом/фтп://дир +www.гоогле.цом

!! end !! test @@ -24954,11 +25019,25 @@ Don't block XML namespace declaration # ----------------------------------------------------------------- # The following section of tests are primarily to spec requirements -# around serialization of new/edited content. +# around Parsoid's serialization (old, new, edited content) # # All these tests are marked Parsoid html2wt and html2html only # ---------------------------------------------------------------- +!! test +Ignore rel attribute in a-tags during serialization to url-links +!! options +parsoid=html2wt +!! html/parsoid +http://en.wikipedia.org/wiki/Foobar +http://en.wikipedia.org/wiki/Foobar +http://en.wikipedia.org/wiki/Foobar +!! wikitext +http://en.wikipedia.org/wiki/Foobar +http://en.wikipedia.org/wiki/Foobar +http://en.wikipedia.org/wiki/Foobar +!! end + # 'mi' is a localinterwiki prefix as well as a language !! test Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869) @@ -24978,9 +25057,15 @@ parsoid=html2wt !! html/parsoid Foo Foo +//en.wikipedia.org/wiki/Foo +http://en.wikipedia.org/wiki/Foo +//en.wikipedia.org/wiki/Foo bar !! wikitext [[Foo]] [[Foo]] +[[:en:Foo|//en.wikipedia.org/wiki/Foo]] +http://en.wikipedia.org/wiki/Foo +[[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]] !! end !! test @@ -25291,6 +25376,17 @@ parsoid=html2wt [[File:Foobar.jpg|link=]] !! end +!! test +Image: Invalid title as link +!! wikitext +[[File:Foobar.jpg|link=<]] +!! html/php +

link=< +

+!! html/parsoid +

+!! end + !! test Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does) !! options -- 2.20.1