jenkins-bot has submitted this change and it was merged. Change subject: Added new + updated old tests for preventing regressions in Parsoid ......................................................................
Added new + updated old tests for preventing regressions in Parsoid Change-Id: I2963d8f2a91ec473eb7c9b063c4c5a4c2de8f82d --- M tests/parser/parserTests.txt 1 file changed, 168 insertions(+), 17 deletions(-) Approvals: GWicke: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 5c35421..e03ac58 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -3080,6 +3080,15 @@ !! end !! test +External link with comments in link text +!! input +[http://www.google.com Google <!-- comment -->] +!! result +<p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a> +</p> +!! end + +!! test URL-encoding in URL functions (single parameter) !! input {{localurl:Some page|amp=&}} @@ -3866,6 +3875,15 @@ Piped link !! input [[Main Page|The Main Page]] +!! result +<p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a> +</p> +!! end + +!! test +Piped link with comment in link text +!! input +[[Main Page|The Main<!--front--> Page]] !! result <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a> </p> @@ -5051,6 +5069,33 @@ <ul><li>d </li></ul> +!!end + +!!test +Test the li-hack +(Cannot test this with PHP parser since it relies on Tidy for the hack) +!!options +parsoid=wt2html,wt2wt +!!input +* foo +* <li>li-hack +* {{echo|<li>templated li-hack}} +* <!--foo--> <li> unsupported li-hack with preceding comments + +<ul> +<li><li>not a li-hack +</li> +</ul> +!!result +<ul><li> foo</li> +<li>li-hack</li> +<li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}'>templated li-hack</li> +<li> <!--foo--> </li><li> li-hack with preceding comments</li></ul> + +<ul> +<li></li><li>not a li-hack +</li> +</ul> !!end ### @@ -14427,10 +14472,15 @@ parsoid !! input =<nowiki>=foo=</nowiki>= + ==<nowiki>=foo=</nowiki>== + ===<nowiki>=foo=</nowiki>=== + ====<nowiki>=foo=</nowiki>==== + =====<nowiki>=foo=</nowiki>===== + ======<nowiki>=foo=</nowiki>====== !! result <h1><span typeof="mw:Nowiki">=foo=</span></h1> @@ -14448,8 +14498,10 @@ !! input =foo= <nowiki>*bar</nowiki> + =foo= =bar + =foo= <nowiki>=bar=</nowiki> !! result @@ -14474,12 +14526,19 @@ parsoid !! input ==foo= + =foo== + = =foo= = + ==foo= bar= + ===foo== + ==foo=== + =''=''foo== + =<nowiki>=</nowiki>= !! result <h1>=foo</h1> @@ -14513,10 +14572,15 @@ parsoid !! input =<nowiki/>= + ==<nowiki/>== + ===<nowiki/>=== + ====<nowiki/>==== + =====<nowiki/>===== + ======<nowiki/>====== !! result <h1></h1> @@ -14528,15 +14592,78 @@ !!end !! test -Headings: 6. Heading chars in SOL context +Headings: 6a. Heading chars in SOL context (with trailing spaces) !! options parsoid !! input -<!--cmt--><nowiki>=h1=</nowiki> -<!--cmt--><nowiki> =h1= </nowiki> !! result -<p><!--cmt--><span typeof="mw:Nowiki">=h1=</span> -<!--cmt--><span typeof="mw:Nowiki"> =h1= </span></p> +<p>=a=</p> +<p>=a= </p> +<p>=a= </p> +<p>=a= </p> +!!end + +!! test +Headings: 6b. Heading chars in SOL context (with trailing newlines) +!! options +parsoid +!! input +<nowiki>=a= +b</nowiki> + +<nowiki>=a= +b</nowiki> + +<nowiki>=a= +b</nowiki> + +<nowiki>=a= +b</nowiki> +!! result +<p>=a= +b</p> +<p>=a= +b</p> +<p>=a= +b</p> +<p>=a= +b</p> +</p> +!!end + +!! test +Headings: 6c. Heading chars in SOL context (leading newline break) +!! options +parsoid +!! input +<nowiki>a +=b=</nowiki> +!! result +<p>a +=b=</p> +!!end + +!! test +Headings: 6d. Heading chars in SOL context (with interspersed comments) +!! options +parsoid +!! input +<!--c0--><nowiki>=a=</nowiki> +<!--c1--> +<nowiki>=a= </nowiki><!--c2--> <!--c3--> +!! result +<p><!--c0-->=a=</p> +<p><!--c1-->=a= <!--c2--> <!--c3--></p> +!!end + +!! test +Headings: 6d. Heading chars in SOL context (No escaping needed) +!! options +parsoid=html2wt +!! input +=a=<div>b</div> +!! result +=a=<div>b</div> !!end #### --------------- Lists --------------- @@ -14947,7 +15074,7 @@ !! end -#### --------------- Links --------------- +#### --------------- Links ---------------- #### 1. Quote marks in link text #### 2. Wikilinks: Escapes needed #### 3. Wikilinks: No escapes needed @@ -15078,7 +15205,7 @@ </p> !! end -#### --------------- Paragraphs --------------- +#### ----------- Paragraphs --------------- #### 1. No unnecessary escapes #### -------------------------------------- @@ -15103,27 +15230,51 @@ </p> !!end -#### --------------- PRE ------------------ -#### 1. Leading space in SOL context should be escaped -#### -------------------------------------- +#### ----------------------- PRE -------------------------- +#### 1. Leading whitespace in SOL context should be escaped +#### ------------------------------------------------------ !! test -1. Leading space in SOL context should be escaped +1. Leading whitespace in SOL context should be escaped !! options parsoid !! input -<nowiki> foo</nowiki> -<!--cmt--><nowiki> foo</nowiki> +<nowiki> a</nowiki> + +<nowiki> a</nowiki> + +<nowiki> a(tab)</nowiki> + +<nowiki> a</nowiki> +<!--cmt--> +<nowiki> a</nowiki> + +<nowiki>a + b</nowiki> + +<nowiki>a + b</nowiki> + +<nowiki>a + b</nowiki> !! result -<p> foo -<!--cmt--> foo -</p> +<p> a</p> +<p> a</p> +<p> a(tab)</p> +<p> a</p> +<p><!--cmt--> a</p> +<p>a + b</p> +<p>a + b</p> +<p>a + b</p> !! end #### --------------- HTML tags --------------- #### 1. a tags #### 2. other tags #### 3. multi-line html tag -#### -------------------------------------- +#### ----------------------------------------- !! test 1. a tags !! options -- To view, visit https://gerrit.wikimedia.org/r/70209 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2963d8f2a91ec473eb7c9b063c4c5a4c2de8f82d Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <[email protected]> Gerrit-Reviewer: GWicke <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
