From: C. Scott Ananian Date: Tue, 4 Aug 2015 20:06:15 +0000 (-0400) Subject: Don't infer parsoid-only parser tests based on presence of parsoid option. X-Git-Tag: 1.34.0-rc.0~3572^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=5dd3012d916b2465d8bc2566491f505f92dcfd7c;p=lhc%2Fweb%2Fwiklou.git Don't infer parsoid-only parser tests based on presence of parsoid option. For historical reasons, we used a complicated test to try to determine if a test is "parsoid only" based on the presence of the string "parsoid" in the parser test options clause. But really test clauses should be marked up specifically as html/php or html/parsoid, we don't need to play hacky games any more. Remove some unnecessary code and simplify the test logic. Change-Id: Ia331e7e12a75aa19aeb96601712f169f2aa75bf9 --- diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 5c4c48c4d4..12c60a7e30 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -122,12 +122,6 @@ class ParserTestRunner { */ private $runDisabled; - /** - * Run tests intended only for parsoid - * @var bool - */ - private $runParsoid; - /** * Disable parse on article insertion * @var bool @@ -170,7 +164,6 @@ class ParserTestRunner { $this->fileBackendName = $options['file-backend'] ?? false; $this->runDisabled = !empty( $options['run-disabled'] ); - $this->runParsoid = !empty( $options['run-parsoid'] ); $this->disableSaveParse = !empty( $options['disable-save-parse'] ); @@ -704,7 +697,6 @@ class ParserTestRunner { foreach ( $filenames as $filename ) { $testFileInfo = TestFileReader::read( $filename, [ 'runDisabled' => $this->runDisabled, - 'runParsoid' => $this->runParsoid, 'regex' => $this->regex ] ); // Don't start the suite if there are no enabled tests in the file diff --git a/tests/parser/TestFileReader.php b/tests/parser/TestFileReader.php index a96485d4d7..8a11b4c16d 100644 --- a/tests/parser/TestFileReader.php +++ b/tests/parser/TestFileReader.php @@ -28,7 +28,6 @@ class TestFileReader { private $sectionLineNum = []; private $lineNum = 0; private $runDisabled; - private $runParsoid; private $regex; private $articles = []; @@ -66,11 +65,9 @@ class TestFileReader { $options = $options + [ 'runDisabled' => false, - 'runParsoid' => false, 'regex' => '//', ]; $this->runDisabled = $options['runDisabled']; - $this->runParsoid = $options['runParsoid']; $this->regex = $options['regex']; } @@ -112,13 +109,6 @@ class TestFileReader { } } - if ( preg_match( '/\\bparsoid\\b/i', $data['options'] ) && $nonTidySection === 'html' - && !$this->runParsoid - ) { - // A test which normally runs on Parsoid but can optionally be run with MW - return; - } - if ( !preg_match( $this->regex, $data['test'] ) ) { // Filtered test return; diff --git a/tests/parser/parserTests.php b/tests/parser/parserTests.php index e1d943f2e4..19d56844ae 100644 --- a/tests/parser/parserTests.php +++ b/tests/parser/parserTests.php @@ -61,7 +61,6 @@ class ParserTestsMaintenance extends Maintenance { 'conjunction with --keep-uploads. Causes a real (non-mock) file backend to ' . 'be used.', false, true ); $this->addOption( 'run-disabled', 'run disabled tests' ); - $this->addOption( 'run-parsoid', 'run parsoid tests (normally disabled)' ); $this->addOption( 'disable-save-parse', 'Don\'t run the parser when ' . 'inserting articles into the database' ); $this->addOption( 'dwdiff', 'Use dwdiff to display diff output' ); @@ -181,7 +180,6 @@ class ParserTestsMaintenance extends Maintenance { 'regex' => $regex, 'keep-uploads' => $this->hasOption( 'keep-uploads' ), 'run-disabled' => $this->hasOption( 'run-disabled' ), - 'run-parsoid' => $this->hasOption( 'run-parsoid' ), 'disable-save-parse' => $this->hasOption( 'disable-save-parse' ), 'use-tidy-config' => $this->hasOption( 'use-tidy-config' ), 'file-backend' => $this->getOption( 'file-backend' ), diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index dc7cafbc0c..30cd372f49 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -2914,6 +2914,23 @@ Self-closed pre

 !! end
 
+!! test
+Newline before table-close generates empty table row: T208619
+!! wikitext
+{|
+
+|}
+!! html/php+tidy
+
+
+
+!! html/parsoid + + +
+!! end + +# PHP has one more row in the output than Parsoid does: T208619 !! test Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced !! options @@ -2927,7 +2944,16 @@ parsoid=wt2html |} -!! html +!! html/php+tidy + + + + + +
+ +
+!! html/parsoid @@ -3205,12 +3231,13 @@ data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"}, !! test Parsoid: Pipe in template with nested template in external link target in template parameter (seriously) -!! options -parsoid !! wikitext {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}} -!! html -

[Main Page bar]

+!! html/php+tidy +

bar +

+!! html/parsoid +

bar

!! end !! test @@ -6246,6 +6273,8 @@ parsoid=wt2html !! end +# Note that the PHP parser output appears to be broken when the table +# end tag is not separated by a space from the style attribute !! test A table with stray table end tags on start tag line (wt2html) !! options @@ -6264,7 +6293,22 @@ parsoid=wt2html {|style="color: red;" |} id="foo" |foo |} -!! html +!! html/php+tidy +
+ +
+ +
foo +
+ + +
foo +
+ + +
foo +
+!! html/parsoid
@@ -7495,6 +7539,7 @@ foo
!!end +# Note: PHP parser omits empty rows !! test Tables: Digest broken attributes on table and tr tag !! options @@ -7504,7 +7549,12 @@ parsoid=wt2html |- || || ++ -- |- > [ |} -!! html +!! html/php+tidy + + + +
+!! html/parsoid @@ -7619,7 +7669,7 @@ parsoid=html2wt Wikitext tables can be nested inside HTML tables !! options parsoid=html2wt -!! html +!! html/parsoid
@@ -7635,6 +7685,15 @@ parsoid=html2wt |}
+!! html/php+tidy + + +
+ + +
foo +
+
!! end ### @@ -8533,27 +8592,32 @@ parsoid=html2wt 1. Interaction of linktrail and template encapsulation !! wikitext {{echo|[[Foo]]}}l +!! html/php+tidy +

Fool +

!! html/parsoid

Fool

!! end !! test 2. Interaction of linktrail and template encapsulation -!! options -parsoid !! wikitext {{echo|Some [[Fool]]}}s -!! html +!! html/php+tidy +

Some Fools +

+!! html/parsoid

Some Fools

!! end !! test 3. Interaction of linktrail and template encapsulation -!! options -parsoid !! wikitext {{echo|Some [[Fool]]s are '''bold and foolish'''}} -!! html +!! html/php+tidy +

Some Fools are bold and foolish +

+!! html/parsoid

Some Fools are bold and foolish

!! end @@ -8733,15 +8797,13 @@ parsoid=wt2html,wt2wt !! wikitext *[[Wikipedia:ro:Olteniţa]] *[[Wikipedia:ro:Olteniţa]] -!! html +!! html/php !! html/php+tidy - + !! html/parsoid
  • Wikipedia:ro:OlteniÅ£a
  • @@ -9910,12 +9972,14 @@ Nested lists 8 (multiple nesting transitions) !! end +# XXX this test should be moved to citeParserTests, since it depends +# on the Cite extension, which is "built in" to Parsoid. !! test Nested lists 9 (extension interaction) -!! options -parsoid !! wikitext * +!! html/php+tidy-DISABLED +
    !! html/parsoid
      !! end @@ -10154,8 +10218,6 @@ parsoid=wt2html,wt2wt !! test Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines -!! options -parsoid !! wikitext #foo ##bar @@ -10165,7 +10227,14 @@ parsoid :foo ::bar -!! html +!! html/php+tidy +
      1. foo +
        1. bar
      +
      • foo +
        • bar
      +
      foo +
      bar
      +!! html/parsoid
      1. foo
        1. bar
        2. @@ -10944,8 +11013,16 @@ Aoeu # From plwiki:PLOS_ONE !! test Parsoid: Page property magic word with magic word contents +!! options +showtitle +!! config +wgAllowDisplayTitle=true +wgRestrictDisplayTitle=false !! wikitext {{DISPLAYTITLE:''{{PAGENAME}}''}} +!! html/php+tidy +Parser test + !! html/parsoid !! end @@ -12184,7 +12261,18 @@ c}}d
          b}} -!! html +!! html/php+tidy +

          ab

          cd +

          ab +

          +
          +

          cd +

          a +

          +
          +

          b +

          +!! html/parsoid

          ab

          cd

          ab

          @@ -12200,13 +12288,16 @@ b}} !! test Parsoid: Merge double tds (T52603) -!! options -parsoid !! wikitext {| |{{echo|{{!}} foo}} |} -!! html +!! html/php+tidy + + +
          foo +
          +!! html/parsoid
          foo
          @@ -12214,15 +12305,20 @@ parsoid !! test Parsoid: Merge double tds in nested transclusion content (T52603) -!! options -parsoid !! wikitext {{echo|
          }} {| |{{echo|{{!}} foo}} |} {{echo|
          }} -!! html +!! html/php+tidy +
          + + +
          foo +
          +
          +!! html/parsoid
          @@ -12956,14 +13052,15 @@ bar
          baz
          bar

          baz
          !! end -!!test +!! test Templates: P-wrapping: 1d. Template preceded by comment-only line -!!options -parsoid !! wikitext {{echo|Bar}} -!! html +!! html/php+tidy +

          Bar +

          +!! html/parsoid

          Bar

          @@ -12976,7 +13073,10 @@ parsoid=wt2html,wt2wt !! wikitext {{echo|
          a
          }}b{{echo|
          c
          }} -!! html +!! html/php+tidy +
          a

          b +

          c
          +!! html/parsoid
          a

          b

          c
          !! end @@ -13393,7 +13493,10 @@ parsoid=wt2html,wt2wt
          foo
          [[Category:foo1]]
          foo
          [[Category:bar1]][[Category:bar2]]
          foo
          -!! html +!! html/php+tidy +
          foo
          +
          foo
          +!! html/parsoid
          foo
          foo
          @@ -13609,7 +13712,9 @@ Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div parsoid=wt2html,wt2wt !! wikitext {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}} -!! html +!! html/php+tidy +
          a
          bcd
          e
          +!! html/parsoid
          a
          bcd
          e
          @@ -14317,7 +14422,10 @@ Parsoid: Recognize nowiki with odd capitalization parsoid=wt2html !! wikitext
          [[foo]] -!! html +!! html/php+tidy +

          <div>[[foo]] +

          +!! html/parsoid

          <div>[[foo]]

          !! end @@ -16723,7 +16831,7 @@ parsoid=wt2html * So should this {{echo|[[Category:Foo]] and this should be part of the same list item}} -!! html +!! html/php+tidy
          • This and this should be part of the same list item
          • So should this and this should be part of the same list item
          !! html/parsoid @@ -16936,13 +17044,15 @@ Category links with multiple namespaces !! test Parsoid: Serialize link to category page with colon escape -!! options -parsoid !! wikitext [[:Category:Foo]] [[:Category:Foo|Bar]] -!! html +!! html/php+tidy +

          Category:Foo +Bar +

          +!! html/parsoid

          Category:Foo Bar @@ -16989,13 +17099,15 @@ x[[es:Foo]]y !! test Parsoid: Serialize link to file page with colon escape -!! options -parsoid !! wikitext [[:File:Foo.png]] [[:File:Foo.png|Bar]] -!! html +!! html/php+tidy +

          File:Foo.png +Bar +

          +!! html/parsoid

          File:Foo.png Bar @@ -17004,12 +17116,11 @@ parsoid !! test Parsoid: Serialize a genuine category link without colon escape -!! options -parsoid !! wikitext [[Category:Foo]] [[Category:Foo|Bar]] -!! html +!! html/php+tidy +!! html/parsoid !! end @@ -19728,19 +19839,17 @@ parsoid=wt2html,html2html !! wikitext ==a== {| STYLE=__TOC__ -!! html +!! html/php

          a[edit]

          -!! html+tidy +!! html/php+tidy

          a[edit]

          - - - - -
          + + +
          !! html/parsoid

          a

          @@ -25582,13 +25691,17 @@ Lead ### !!test 1. SOL-sensitive wikitext tokens as template-args -!!options +!! options parsoid=wt2html,wt2wt !! wikitext {{echo|*a}} {{echo|#a}} {{echo|:a}} -!! html +!! html/php+tidy +
          • a
          +
          1. a
          +
          a
          +!! html/parsoid
          • a
          @@ -27921,17 +28034,20 @@ Indent and comment before table row
    !! end -# Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext +# PHP parser omits empty TR !!test Empty TR followed by a template-generated TR -!!options -parsoid !! wikitext {| |- {{echo|foo}} |} -!! html +!! html/php+tidy + + + +
    foo
    +!! html/parsoid @@ -27940,12 +28056,10 @@ parsoid
    !!end -## PHP and parsoid output differ for this, and since this is primarily -## for testing Parsoid's serializer, marking this Parsoid only +## PHP and parsoid output differ for this; as usual PHP omits empty +## elements, and since it strips the comments the TR is empty. !!test Empty TR followed by mixed-ws-comment line should RT correctly -!!options -parsoid !! wikitext {| |- @@ -27953,7 +28067,12 @@ parsoid |- |} -!! html +!! html/php+tidy + + + +
    +!! html/parsoid @@ -28621,11 +28740,11 @@ parsoid={ !! test Image: empty alt attribute (T50924) -!! options -parsoid !! wikitext [[File:Foobar.jpg|thumb|alt=|bar]] -!! html +!! html/php+tidy +
    bar
    +!! html/parsoid
    bar
    !! end @@ -29892,7 +30011,7 @@ parsoid={ Serialize wikitext list items as HTML list items when embedded in a HTML list !! options parsoid=html2wt -!! html +!! html/parsoid +!! html/php+tidy + !! end -# SSS FIXME: Is this actually a good thing given the -# odd nested list output that is generated by MW? +# Nested list should be inside
  • , that is # instead of # +# See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list !! test Wikitext lists can be nested inside HTML lists !! options parsoid=html2wt -!! html +!! html/parsoid +!! html/php+tidy + + !! end !! test @@ -30379,7 +30514,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid

    foo x

    @@ -30537,7 +30672,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": false } -!! html +!! html/parsoid
  • @@ -30560,7 +30695,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid
    a
    -
    @@ -30717,7 +30852,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": true } -!! html +!! html/parsoid foobarboo @@ -30734,7 +30869,7 @@ parsoid={ "modes": ["html2wt"], "scrubWikitext": false } -!! html +!! html/parsoid foo !! wikitext foo
    a
    -