jenkins-bot has submitted this change and it was merged.

Change subject: Fix a bunch of broken wikitext escaping tests
......................................................................


Fix a bunch of broken wikitext escaping tests

* These have been broken for a long time when we still had these
  tests in core (at least 1.5 years now ... the horror!).
* The HTML for these tests should NOT have mw:nowiki spans since
  we are testing whether escapable text in the HTML gets serialized
  with <nowiki> in wikitext!
* Exposed two failing wikitext tests.

Change-Id: If712ddf6433f559348bce75c5f2e108b45e900ee
---
M tests/parserTests-blacklist.js
M tests/parserTests.txt
2 files changed, 56 insertions(+), 38 deletions(-)

Approvals:
  Cscott: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index f2214e0..24e9156 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -523,6 +523,7 @@
 add("wt2wt", "Ref: 10. Unclosed HTML tags should not leak out of ref-body", "A 
<ref><b> foo </ref> B C\n\n<references />");
 add("wt2wt", "References: 5. ref tags in references should be processed while 
ignoring all other content", "A <ref name=\"a\" />\nB <ref 
name=\"b\">bar</ref>\n\n<references>\n<ref 
name=\"a\">foo</ref>\n</references>");
 add("wt2wt", "Entities in ref name", "<ref name=\"test & me\">hi</ref>\n");
+add("wt2wt", "Headings: 4a'. No escaping needed (Parsoid bug T84903)", "= 
''<nowiki>=</nowiki>''foo= =\n");
 add("wt2wt", "HTML tag with broken attribute value quoting", "<span 
title=\"Hello world\">Foo</span>\n");
 add("wt2wt", "Parsoid-only: HTML tag with broken attribute value quoting", 
"<span title=\"Hello world\">Foo</span>\n");
 add("wt2wt", "Table with broken attribute value quoting", "{|\n| title=\"Hello 
world\" |Foo\n|}");
@@ -1750,6 +1751,7 @@
 add("html2wt", "Lists: 2. Inside definition lists", "; 
<nowiki>;foo</nowiki>\n\n; <nowiki>:foo</nowiki>\n\n; <nowiki>:foo</nowiki>\n: 
bar\n\n: <nowiki>:foo</nowiki>\n");
 add("html2wt", "Lists: 3. Only bullets at start of text should be escaped", "* 
<nowiki>*foo*bar</nowiki>\n\n* <nowiki>*foo</nowiki>''it''*bar\n");
 add("html2wt", "Lists: 4. No escapes needed", "* foo*bar\n\n* ''foo''*bar\n\n* 
[[Foo]]: bar\n\n* [[Foo]]*bar\n");
+add("html2wt", "HRs: 1. Single line", 
"----\n<nowiki>----</nowiki>\n----\n<nowiki>=foo=</nowiki>\n----\n<nowiki>*</nowiki>foo\n");
 add("html2wt", "Links 13: Protect link-like plain text. (Parsoid bug T78425)", 
"this is not a link: http://example.com\n";);
 add("html2wt", "1. Leading whitespace in SOL context should be escaped", 
"<nowiki> </nowiki>a\n\n<nowiki> </nowiki> a\n\n\ta(tab)\n\n 
\ta\n\n<!--cmt--><nowiki> </nowiki> a\n\na\n<nowiki> 
</nowiki>b\n\na\n\tb\n\na\n\t b\n");
 add("html2wt", "3. Leading whitespace in indent-pre suppressing contexts 
should not be escaped", "<blockquote>\n\n a\n <span>b</span>\n 
c\n</blockquote>");
@@ -2799,6 +2801,8 @@
 add("selser", "References: 5. ref tags in references should be processed while 
ignoring all other content [0,2,0]", "A <ref name=\"a\" />\nB <ref 
name=\"b\">bar</ref>\n\nky16pugtafywrk9\n\n<references>\n<ref 
name=\"a\">foo</ref>\nThis should just get lost.\n</references>");
 add("selser", "Entities in ref name [2]", "72oie2a08o69wwmi\n\n<ref 
name=\"test &amp; me\">hi</ref>");
 add("selser", "Entities in ref name [1]", "<ref name=\"test &amp; 
me\">hi</ref>");
+add("selser", "Headings: 4a'. No escaping needed (Parsoid bug T84903) [2]", 
"qj77lglp8h5jnhfr\n= ''=''foo= =");
+add("selser", "Headings: 4a'. No escaping needed (Parsoid bug T84903) [1]", "= 
''=''foo= =");
 add("selser", "Headings: 5. Empty headings [[2],3,2,0,4,4,0,2,1,3,0]", 
"=hnjo2713bjvjwcdi<nowiki/>=\nx2d05yq3dapaxlxr\n==<nowiki/>==\n\nkaovt9si227ta9k9\n\nb2688fvzpaocrf6r\n====<nowiki/>====\nljshl952j0emte29\n\n=====<nowiki/>=====\n\n======<nowiki/>======");
 add("selser", "Headings: 6a. Heading chars in SOL context (with trailing 
spaces) [4,0,1,0,4,4,[2],3]", "o4fu7yz6zedvlsor\n\n<nowiki>=a=</nowiki> 
\n\nfzi337zwgfmbzkt9\n\nrziif3qr3rspp66r\n\nzm9kz709iqpsnhfr<nowiki>=a=</nowiki>
 \t");
 add("selser", "1. Quotes inside <b> and <i> 
[[3,2,1,3,0,3,4,0,2,3,0,1,4,1,3,[2,0,0,0],0,0,0,0,[3],0,0,4,0,0,2,3,3,[2],3,4,3,0,0,3,4,3,3,0,2,0,[4]]]",
 
"3ggp4kwixzloko6r\n''<nowiki>''foo''</nowiki><nowiki>'''foo'''</nowiki>''wednybdch5ixusor<nowiki/>jiu7uxfou9n6d2t9's\n\n'''<nowiki>''foo''</nowiki>'''5yp9smtnl1bgldi'''<nowiki>'''foo'''</nowiki>0adusjelvz3t0529foo'<nowiki/>''bar'<nowiki/>''baz'''\n'''foo'''<nowiki/>'s\n'''<nowiki/>''\n''foo''myh73q54kveljtt9'\n'<nowiki/>c10qrc4l4kkjra4i''foo'''''c9meu8765gjpp66rfoo'''1wwik15k156x0f6r'\n'<nowiki/>8qu5jiqalmvg3nmi\n191wmp849f7gmn29''<span>fool</span>'s
 errand''\na|!*#-:;+-~[]{}b'''6zhdeznwfwxko6r''");
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index e9f26b6..75c5486 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -19910,17 +19910,15 @@
 !! test
 Headings: 3. Nested inside html with wikitext split by html tags
 !! options
-parsoid=html2wt
+parsoid=html2wt,wt2wt
 !! wikitext
 = ='''bold'''<nowiki>foo=</nowiki> =
-!! html
-<h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
+!! html/parsoid
+<h1>=<b>bold</b>foo=</h1>
 !!end
 
 !! test
 Headings: 4a. No escaping needed (testing just h1 and h2)
-!! options
-parsoid=html2wt
 !! wikitext
 = =foo =
 
@@ -19934,19 +19932,27 @@
 
 == foo= ==
 
-= ''=''foo= =
-
-= <nowiki>=</nowiki> =
-!! html
+= = =
+!! html/parsoid
 <h1>=foo</h1>
 <h1>foo=</h1>
 <h1> =foo= </h1>
 <h1>=foo= bar</h1>
 <h2>=foo</h2>
 <h2>foo=</h2>
-<h1><i>=</i>foo=</h1>
-<h1><span typeof="mw:Nowiki">=</span></h1>
+<h1>=</h1>
 !!end
+
+!! test
+Headings: 4a'. No escaping needed (Parsoid bug T84903)
+!! wikitext
+= ''=''foo= =
+!! html/php
+<h1><span class="mw-headline" id=".3Dfoo.3D"><i>=</i>foo=</span><span 
class="mw-editsection"><span class="mw-editsection-bracket">[</span><a 
href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit 
section: =foo=">edit</a><span 
class="mw-editsection-bracket">]</span></span></h1>
+
+!! html/parsoid
+<h1><i>=</i>foo=</h1>
+!! end
 
 !! test
 Headings: 4b. No escaping needed (inside p-tags)
@@ -20219,11 +20225,11 @@
 !! test
 Lists: 6. Escape bullets in SOL position
 !! options
-parsoid
+parsoid=html2wt
 !! wikitext
-<!--cmt--><nowiki>*foo</nowiki>
+<!--cmt--><nowiki>*</nowiki>foo
 !! html
-<p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
+<p><!--cmt-->*foo</p>
 !!end
 
 !! test
@@ -20253,16 +20259,17 @@
 
 !! test
 HRs: 1. Single line
-!! options
-parsoid
 !! wikitext
 ----<nowiki>----</nowiki>
 ----=foo=
 ----*foo
-!! html
-<hr><p><span typeof="mw:Nowiki">----</span></p>
-<hr><p>=foo=</p>
-<hr><p>*foo</p>
+!! html+tidy
+<hr />
+<p>----</p>
+<hr />
+<p>=foo=</p>
+<hr />
+<p>*foo</p>
 !! end
 
 #### --------------- Tables ---------------
@@ -20352,21 +20359,28 @@
 
 !! test
 Tables: 2b. Nested in td
+!! options
+parsoid=html2wt
+!! html/parsoid
+<table><tbody><tr>
+<td>foo||bar</td>
+<td>a<i>b||c</i></td>
+<td>a<i><div>b||c</div></i></td>
+</tr></tbody></table>
 !! wikitext
 {|
 |<nowiki>foo||bar</nowiki>
-|''it''<nowiki>foo||bar</nowiki>
+|a''<nowiki>b||c</nowiki>''
+|a''<div><nowiki>b||c</nowiki></div>''
 |}
-!! html/parsoid
-<table><tbody><tr>
-<td><span typeof="mw:Nowiki">foo||bar</span></td>
-<td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
 !! html/php
 <table>
 <tr>
 <td>foo||bar
 </td>
-<td><i>it</i>foo||bar
+<td>a<i>b||c</i>
+</td>
+<td>a<i><div>b||c</div></i>
 </td></tr></table>
 
 !! end
@@ -20461,19 +20475,19 @@
 
 !! test
 Tables: 4a. Escape -
+!! options
+parsoid=html2wt
 !! wikitext
 {|
+
 !-bar
+
 |-
 |<nowiki>-bar</nowiki>
 |}
-!! html/parsoid
-<table><tbody>
-<tr><th>-bar</th></tr>
-<tr>
-<td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
-!! html/php
+!! html/*
 <table>
+
 <tr>
 <th>-bar
 </th></tr>
@@ -20485,14 +20499,19 @@
 
 !! test
 Tables: 4b. Escape +
+!! options
+parsoid=html2wt
 !! wikitext
 {|
+
 !+bar
+
 |-
 |<nowiki>+bar</nowiki>
 |}
-!! html/php
+!! html/*
 <table>
+
 <tr>
 <th>+bar
 </th></tr>
@@ -20500,11 +20519,6 @@
 <td>+bar
 </td></tr></table>
 
-!! html/parsoid
-<table><tbody>
-<tr><th>+bar</th></tr>
-<tr>
-<td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
 !! end
 
 !! test

-- 
To view, visit https://gerrit.wikimedia.org/r/180785
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If712ddf6433f559348bce75c5f2e108b45e900ee
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to