From d1869088d2c4903dfa8b2c62ed0c18f4a40ea8b9 Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Thu, 25 Apr 2013 15:22:30 +0530 Subject: [PATCH] Updated wikitext-escaping tests to reflect Parsoid's latest output * Changed wikitext (input) portion of several html2wt-centric tests to match how Parsoid adds the nowiki tags. We are not as concerned about the wt -> html direction. * Changed 'disabled' flag to 'parsoid' on several tests since that was the original intention of these disabled tests. Since then, we have the parsoid option to indicate the same thing which is more accurate than 'disabled'. * Added few more escaping tests based on recent Parsoid fixes and discovery of new bugs. * Disabled one test known to not pass because of absence of data-parsoid flags. Change-Id: Icd10a9bccbcc27715914b9f00a20afb06ed275d1 --- tests/parser/parserTests.txt | 182 ++++++++++++++++++++++------------- 1 file changed, 115 insertions(+), 67 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 0631196dd4..a587a76a9e 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -3665,7 +3665,7 @@ Table with empty line following the start tag !! test Table attributes with empty value !! options -disabled +parsoid !! input {| | style=| hello @@ -4756,9 +4756,9 @@ Nested lists 8 (multiple nesting transitions) !! test Unbalanced closing block tags break a list -(Disabled since php parser generates broken html -- relies on Tidy to fix up) +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) !! options -disabled +parsoid !! input
*a
@@ -4773,9 +4773,9 @@ disabled !! test Unbalanced closing non-block tags don't break a list -(Disabled since php parser generates broken html -- relies on Tidy to fix up) +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) !! options -disabled +parsoid !! input *a @@ -4790,9 +4790,9 @@ disabled !! test Unclosed formatting tags that straddle lists are closed and reopened -(Disabled since php parser generates broken html -- relies on Tidy to fix up) +(Parsoid-only since php parser generates broken html -- relies on Tidy to fix up) !! options -disabled +parsoid !! input # a # b @@ -6532,7 +6532,7 @@ Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo) Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span) (PHP parser generates misnested html) !! options -disabled +parsoid !!input {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}} !!result @@ -6543,7 +6543,7 @@ disabled Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div) (PHP parser generates misnested html) !! options -disabled +parsoid !!input {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} !!result @@ -8595,7 +8595,7 @@ div with illegal double attributes !! test div with empty attribute value, space before equals !! options -disabled +parsoid !! input
HTML rocks
!! result @@ -8608,7 +8608,7 @@ disabled !! test div with braces in attribute value !! options -disabled +parsoid !! input
Foo
!! result @@ -8625,7 +8625,7 @@ disabled !! test div with empty attribute value, no space before equals !! options -disabled +parsoid !! input
HTML rocks
!! result @@ -13573,7 +13573,7 @@ HttP://MediaWiki.Org/ !!test 1. SOL-sensitive wikitext tokens as template-args !!options -disabled +parsoid !!input {{echo|*a}} {{echo|#a}} @@ -13586,12 +13586,15 @@ disabled !!end #### The following section of tests are primarily to test -#### wikitext escaping capabilities of Parsoid. -#### A lot of the tests are disabled for the PHP parser either -#### because of minor newline diffs or other reasons. -#### As Parsoid serializer can handle newlines and other HTML -#### more robustly, some of these tests might get reenabled -#### for the PHP parser. +#### wikitext escaping capabilities of Parsoid. Given that +#### escaping can be done any number of ways, the wikitext (input) +#### is always adjusted to reflect how Parsoid adds nowiki +#### escape tags. +#### +#### We are marking several tests as parsoid-only since the +#### HTML in the result section is different from what the +#### PHP parser generates for it. + #### --------------- Headings --------------- #### 0. Unnested @@ -13604,12 +13607,20 @@ disabled #### ---------------------------------------- !! test Headings: 0. Unnested +!! options +parsoid !! input =foo= -=foo''a''= + =foo= + +=foo= + +=foo''a''= !! result

=foo= +

=foo= +

=foo=

=fooa=

!!end @@ -13617,7 +13628,7 @@ Headings: 0. Unnested !! test Headings: 1. Nested inside html !! options -disabled +parsoid !! input ==foo== ===foo=== @@ -13637,7 +13648,7 @@ disabled !! test Headings: 2. Outside heading nest on a single line

foo

*bar !! options -disabled +parsoid !! input =foo= *bar @@ -13654,44 +13665,64 @@ disabled !! test Headings: 3. Nested inside html with wikitext split by html tags !! options -disabled +parsoid !! input -=='''bold'''foo== +=='''bold'''foo== !! result

=boldfoo=

!!end !! test -Headings: 4. No escaping needed (testing just h1 and h2) +Headings: 4a. No escaping needed (testing just h1 and h2) !! options -disabled +parsoid !! input ==foo= =foo== += =foo= = +==foo= bar= ===foo== ==foo=== =''=''foo== -=== +=== !! result

=foo

foo=

+

=foo=

+

=foo= bar

=foo

foo=

=foo=

=

+ +!!end + +!! test +Headings: 4b. No escaping needed (inside p-tags) +!! options +parsoid +!! input +=== +=foo= x +=foo= +!! result +

=== +=foo= x +=foo= +

!!end !! test Headings: 5. Empty headings !! options -disabled +parsoid !! input -== -==== -====== -======== -========== -============ +== +==== +====== +======== +========== +============ !! result

@@ -13704,11 +13735,13 @@ disabled !! test Headings: 6. Heading chars in SOL context !! options -disabled +parsoid !! input =h1= + =h1= !! result

=h1= + =h1=

!!end @@ -13814,7 +13847,7 @@ Lists: 3. Only bullets at start of text should be escaped !! test Lists: 4. No escapes needed !! options -disabled +parsoid !! input *foo*bar @@ -13839,9 +13872,11 @@ Lists: 5. No unnecessary escapes *[[bar [[foo]] -*]]bar [[foo]] +*]]bar [[foo]] *=bar foo]]= + +* : a !! result
  • bar [[foo]]
@@ -13853,13 +13888,15 @@ Lists: 5. No unnecessary escapes
  • =bar foo]]=
+
  • : a +
!!end !! test Lists: 6. Escape bullets in SOL position !! options -disabled +parsoid !! input *foo !! result @@ -13885,14 +13922,11 @@ Lists: 7. Escape bullets in a multi-line context !! test HRs: 1. Single line !! options -disabled +parsoid !! input ----- ----- ----- -=foo= ----- -*foo +-------- +----=foo= +----*foo !! result
----
=foo= @@ -13959,7 +13993,7 @@ Tables: 1d. No escaping needed !! test Tables: 2a. Nested in td !! options -disabled +parsoid !! input {| |foo|bar @@ -13974,7 +14008,7 @@ disabled !! test Tables: 2b. Nested in td !! options -disabled +parsoid !! input {| |foo||bar @@ -13991,7 +14025,7 @@ disabled !! test Tables: 2c. Nested in td -- no escaping needed !! options -disabled +parsoid !! input {| |foo!!bar @@ -14006,7 +14040,7 @@ disabled !! test Tables: 3a. Nested in th !! options -disabled +parsoid !! input {| !foo!bar @@ -14021,7 +14055,7 @@ disabled !! test Tables: 3b. Nested in th !! options -disabled +parsoid !! input {| !foo!!bar @@ -14036,10 +14070,10 @@ disabled !! test Tables: 3c. Nested in th -- no escaping needed !! options -disabled +parsoid !! input {| -!foo||bar +!foo||bar |} !! result @@ -14051,7 +14085,7 @@ disabled !! test Tables: 4a. Escape - !! options -disabled +parsoid !! input {| |- @@ -14069,7 +14103,7 @@ disabled !! test Tables: 4b. Escape + !! options -disabled +parsoid !! input {| |- @@ -14087,7 +14121,7 @@ disabled !! test Tables: 4c. No escaping needed !! options -disabled +parsoid !! input {| |- @@ -14104,8 +14138,16 @@ disabled
!! 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 !! input {| ||+1 @@ -14131,7 +14173,7 @@ Tables: 4d. No escaping needed !! test Links 1. Quote marks in link text !! options -disabled +parsoid !! input [[Foo|Foo''boo'']] !! result @@ -14141,15 +14183,18 @@ disabled !! test Links 2. WikiLinks: Escapes needed !! options -disabled +parsoid !! input [[Foo|[Foobar]]] [[Foo|Foobar]]] -[[Foo|x [Foobar] x]] +[[Foo|x [Foobar] x]] [[Foo|x [http://google.com g] x]] [[Foo|[[Bar]]]] [[Foo|x [[Bar]] x]] [[Foo||Bar]] +[[Foo|]]bar]] +[[Foo|[[bar]] +[[Foo|x ]] y [[ z]] !! result [Foobar] Foobar] @@ -14158,12 +14203,15 @@ disabled [[Bar]] x [[Bar]] x |Bar +]]bar +[[bar +x ]] y [[ z !! end !! test Links 3. WikiLinks: No escapes needed !! options -disabled +parsoid !! input [[Foo|[Foobar]] [[Foo|foo|bar]] @@ -14175,7 +14223,7 @@ disabled !! test Links 4. ExtLinks: Escapes needed !! options -disabled +parsoid !! input [http://google.com [google]] [http://google.com google]] @@ -14187,7 +14235,7 @@ disabled !! test Links 5. ExtLinks: No escapes needed !! options -disabled +parsoid !! input [http://google.com [google] !! result @@ -14259,9 +14307,9 @@ bar [[foo]] [[bar [[foo]] -]]bar [[foo]] +]]bar [[foo]] -=bar foo]]= +=bar foo]]= !! result

bar [[foo]]

=bar [[foo]] @@ -14277,7 +14325,7 @@ bar [[foo]] !! test 1. Leading space in SOL context should be escaped !! options -disabled +parsoid !! input foo foo @@ -14295,7 +14343,7 @@ disabled !! test 1. a tags !! options -disabled +parsoid !! input google !! result @@ -14335,8 +14383,8 @@ Escaping nowikis

<nowiki>foo</nowiki>

!! end - !! test + Tag-like HTML structures are passed through as text !! input @@ -14369,7 +14417,7 @@ a>b !! test Tag names followed by punctuation should not be recognized as tags !! options -disabled +parsoid !! input text !! result -- 2.20.1