From: C. Scott Ananian Date: Sat, 23 Feb 2013 04:26:08 +0000 (-0500) Subject: Add 'parsoid' option to parserTests.txt. X-Git-Tag: 1.31.0-rc.0~20528 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;ds=sidebyside;h=2c56e3b08784578d5339bf258a7dead8d4f5d392;p=lhc%2Fweb%2Fwiklou.git Add 'parsoid' option to parserTests.txt. Rather than overload the 'disabled' option, explicitly mark Parsoid-only parser tests with "parsoid" in the options field. These are disabled by default when the PHP parser tests are run (but you could explicitly enable them with --run-parsoid if you wished, in the same way that you can enable other disabled tests with --run-disabled). Document the 'php' option, which the PHP parser tests will ignore, but will (in the future) be used to mark php-only tests which should be ignored by the Parsoid parser. Tweaked 'disabled' option to 'parsoid' for those tests which explicitly call themselves parsoid-only. I was conservative in this patch; if the title of the test didn't explicitly mention Parsoid, I left the test disabled rather than switch it to parsoid. Change-Id: Id6c396f7966fcb21c1e54e222ab0c9f4e3a34dcc --- diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 13217e21ff..ce621f4e37 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -131,6 +131,7 @@ class ParserTest { } $this->runDisabled = isset( $options['run-disabled'] ); + $this->runParsoid = isset( $options['run-parsoid'] ); $this->hooks = array(); $this->functionHooks = array(); diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 0716d799c1..5f4090e4dd 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -21,6 +21,8 @@ # language=XXX set content language to XXX for this test # variant=XXX set the variant of language for this test (eg zh-tw) # disabled do not run test +# parsoid parsoid-only test (not run by PHP parser) +# php php-only test (not run by the parsoid parser) # showtitle make the first line the title # comment run through Linker::formatComment() instead of main parser # local format section links in edit comment text as local links @@ -1807,7 +1809,7 @@ Table / list interaction: lists nested in tables nested in indented lists !! test Definition Lists: Nesting: Multi-level (Parsoid only) !! options -disabled +parsoid !! input ;t1 :d1 ;;t2 ::d2 @@ -1837,7 +1839,7 @@ disabled !! test Definition Lists: Nesting: Test 2 (Parsoid only) !! options -disabled +parsoid !! input ;t1 ::d2 @@ -1857,7 +1859,7 @@ disabled !! test Definition Lists: Nesting: Test 3 (Parsoid only) !! options -disabled +parsoid !! input :;t1 ::::d2 @@ -4296,7 +4298,7 @@ disabled List embedded in a non-block tag (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy) !! options -disabled +parsoid !!input * foo @@ -5978,7 +5980,7 @@ a
bc
de Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting (Parsoid-centric) !! options -disabled +parsoid !!input {| |{{echo|foo}} @@ -5995,7 +5997,7 @@ bar Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting (Parsoid-centric) !! options -disabled +parsoid !!input @@ -13687,7 +13689,7 @@ HTML tag with broken attribute value quoting !! test Parsoid-only: HTML tag with broken attribute value quoting !! options -disabled +parsoid !! input Start the fuzz test from the specified seed --help Show this help message --run-disabled run disabled tests + --run-parsoid run parsoid tests (normally disabled) ENDS; exit( 0 ); diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index f8d0c37f53..bf6931a1f6 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -16,6 +16,7 @@ class NewParserTest extends MediaWikiTestCase { public $keepUploads = false; public $runDisabled = false; + public $runParsoid = false; public $regex = ''; public $showProgress = true; public $savedInitialGlobals = array(); diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index 1e51d80939..02fcf24ce4 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -450,6 +450,7 @@ class TestFileIterator implements Iterator { } if ( ( ( preg_match( '/\\bdisabled\\b/i', $this->sectionData['options'] ) && !$this->parserTest->runDisabled ) + || ( preg_match( '/\\bparsoid\\b/i', $this->sectionData['options'] ) && !$this->parserTest->runParsoid ) || !preg_match( "/" . $this->parserTest->regex . "/i", $this->sectionData['test'] ) ) ) { # disabled test