From 6b33e7fc21b4f6e03bd2e2ba4912eb49836ecbcf Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Tue, 17 Mar 2015 10:02:25 -0700 Subject: [PATCH] Sync up with Parsoid parserTests. This now aligns with Parsoid commit 9d213e1eb420bfd9ef6fbc661556b40c8aee32f6 Change-Id: Icb9de1ae26a7148fb0fe68840c5a9cfd45640560 --- tests/parser/parserTests.txt | 311 ++++++++++++++++++++++++++++++++++- 1 file changed, 308 insertions(+), 3 deletions(-) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 53814c53e9..36a78722c0 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -69,6 +69,12 @@ Template:pipe | !! endarticle +!! article +Template:= +!! text += +!! endarticle + !!article MediaWiki:bad image list !!text @@ -126,6 +132,19 @@ Template:table_attribs_2 |Bar||Baz !! endarticle +!! article +Template:table_attribs_3 +!! text + +|style{{=}}"background:#f9f9f9;"|Foo +!! endarticle + +!! article +Template:table_attribs_4 +!! text +| style="background-color:#DC241f;" width="10px" | +!! endarticle + !! article Template:table_header_cells !! text @@ -154,6 +173,13 @@ style="color:red;" title="T48811" |foo !! endarticle +!! article +Template:definition_list +!! text +one +::two +!! endarticle + !! article A?b !! text @@ -1391,6 +1417,64 @@ parsoid=html2wt * </nowiki> tag !! end +!! test +T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars +!! options +parsoid=html2wt +!! html +

This text: L'Foo +This text: L''Foo +This text: L'''Foo''

+!! wikitext +This text: L'[[Foo]] +This text: L''[[Foo]] +This text: L'''[[Foo]]'' +!! end + +# This test fails because wikitext whitespace is not normalized before comparing. +!! test +T71950: 2. Put nowiki as close to cause as possible, after ' :' +!! options +parsoid=html2wt +!! html +

This text : L''Foo +

+!! wikitext +This text : L''[[Foo]] +!! end + +# This test and the next one are html2wt only as they test that incorrect wikitext +# passed in template arguments gets escaped or wrapped in nowikis where required. +!! test +T71482: Use {{!}} instead of nowiki for single pipe in template argument +!! options +parsoid=html2wt +!! html/parsoid +

+

+!! wikitext +{{echo|foo{{!}}bar}} +{{echo|foo|bar |[[}} +!! end + +!! test +T53961: Output correct nowikis in template arguments +!! options +parsoid=html2wt +!! html/parsoid +

+ + + +

+!! wikitext +{{echo|a [ b}} +{{echo|a }} b}} +{{echo|a [[ b}} +{{echo|a {{!}} {{ ]]}} +{{echo|a }}} +!! end + ### ### Comments ### @@ -4064,6 +4148,28 @@ Definition Lists: colons and tables 2 !! end +!! test +Definition Lists: template interaction +!! wikitext +::{{definition_list}} + +:one +::{{definition_list}} +:::two +:::three +::four +!! html/parsoid +
one
+
two
+ +
one +
one
+
two +
two
+
three
+
four
+!! end + ### ### External links @@ -6102,6 +6208,28 @@ parsoid=wt2html,html2html !! end +!! test +Table cells not properly parsed in an implicit-td context +!! wikitext +{| +|- +{{table_attribs_4}} || a || b +|} +!! html/php+tidy + + + + + + +
ab
+!! html/parsoid + + + +
a b
+!! end + !! test Parsoid: Round-trip tables directly followed by content (bug 51219) !! options @@ -8029,6 +8157,16 @@ Nested lists 8 (multiple nesting transitions) !! end +!! test +Nested lists 9 (extension interaction) +!! options +parsoid +!! wikitext +* +!! html/parsoid + +!! end + !! test 1. Lists with start-of-line-transparent tokens before bullets: Comments !! wikitext @@ -8301,11 +8439,9 @@ parsoid=wt2html,wt2wt,html2html
  • b
  • !! end -# Parsoid fails this test, but it might be tricky to support properly. # See bug 68395. !!test -List embedded in a non-block tag -(Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy) +1. List embedded in a formatting tag !! wikitext * foo @@ -8322,6 +8458,53 @@ List embedded in a non-block tag !!end +## Ugly Parsoid output here +## Not sure what the right output is. +!!test +2. List embedded in a formatting tag +!! wikitext + +*a +*b +!! html/php+tidy + +!! html/parsoid + + +!!end + +# Ugly Parsoid and PHP parser output here +# Not sure if we want to make this a test! +# +## !!test +## 3. Unclosed formatting tags in list elements +## !! wikitext +## *a +## *b +## !! html/php+tidy +##
      +##
    • a
    • +##
    • b
    • +##
    +## !! html/parsoid +##
      +##
    • a
    • +## +##
    • b
    • +##
    +## !!end + +# This is a bug in the PHP parser + tidy combination. +# (The tag gets parsed as text and html-escaped by PHP, +# and then fostered out of the table by tidy.) +# We believe the Parsoid output to be correct. !! test Table with missing opening tag !! options @@ -10396,6 +10579,35 @@ Templates: Support for templates generating attributes and content !!end +!! test +1. Entities and nowikis inside templated attributes should be handled correctly +!! wikitext +
    foo
    +!! html/php +
    foo
    + +!! html/parsoid +
    foo
    +!! end + +!! test +2. Entities and nowikis inside templated attributes should be handled correctly +!! wikitext +{| +|{{table_attribs_3}} +|} +!! html/php + + +
    Foo +
    + +!! html/parsoid + + +
    Foo
    +!! end + !!test Templates: HTML Tables: 1. Generating start of a HTML table !! wikitext @@ -12029,6 +12241,17 @@ parsoid=wt2html,wt2wt,html2html

    testing bold in alt

    !! end +!! test +Alt image option should handle most kinds of wikitext without barfing +!! wikitext +[[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]] +!! html/php +
    This is a link and a bold template.
    This is the image caption
    + +!! html/parsoid +
    This is a link and a bold template.
    This is the image caption
    +!! end + ################### # Conflicting image format options. # First option specified should 'win'. @@ -20383,6 +20606,22 @@ foo foo
      !! end +#### ---------------------------------------------------------------- +#### Parsoid-only testing of Parsoid's impl of LST +#### Not implemented yet, see +#### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST +#### ---------------------------------------------------------------- + +!!test +LST Sections: 1. Simple section start and end +!! wikitext +
      +
      +!! html/parsoid +

      +

      +!! end + #--------- Test stripping of empty nodes in template content ---------- !!test Empty LI and TR nodes should be stripped from template content @@ -23171,6 +23410,22 @@ parsoid=html2wt [[Foo''bar''baz]] !! end +!! test +Enforce single-line context in the serializer +!! options +parsoid=html2wt +!! html +

      testing +123

      + +
      • asd +sdf
      +!! wikitext +== testing 123 == + +* asd sdf +!! end + #----------------------------- # I/B quote minimization tests #----------------------------- @@ -23454,6 +23709,56 @@ parsoid=html2wt !! end +# Note that the

      wrapping isn't present in PHP parser output +# The important thing for this test is that P-wrapping doesn't +# interfere with the protection for leading - in +# (which isn't necessary for ). +!! test +T88318: p-wrapped dash in table. +!! options +parsoid=html2wt,wt2wt +!! html/parsoid + + + + +

      -

      -

      -

      -

      -

      -


      -
      +!! wikitext +{| +!- +!- +|- +|- +|- +|- +|- +|
      +- +|
      +- +|} +!! html/php+tidy + + + + + + + + + + + + + + +
      --
      --
      -
      +

      -

      +

      +

      -

      +
      +!! end + # ----------------------------------------------------------------- # End of section for Parsoid-only html2wt tests for serialization # of new content -- 2.20.1