Add 'parsoid' option to parserTests.txt.
authorC. Scott Ananian <cscott@cscott.net>
Sat, 23 Feb 2013 04:26:08 +0000 (23:26 -0500)
committerSubramanya Sastry <ssastry@wikimedia.org>
Fri, 1 Mar 2013 00:42:37 +0000 (18:42 -0600)
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

tests/parser/parserTest.inc
tests/parser/parserTests.txt
tests/parserTests.php
tests/phpunit/includes/parser/NewParserTest.php
tests/testHelpers.inc

index 13217e2..ce621f4 100644 (file)
@@ -131,6 +131,7 @@ class ParserTest {
                }
 
                $this->runDisabled = isset( $options['run-disabled'] );
+               $this->runParsoid = isset( $options['run-parsoid'] );
 
                $this->hooks = array();
                $this->functionHooks = array();
index 0716d79..5f4090e 100644 (file)
@@ -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
 <small>
 * foo
@@ -5978,7 +5980,7 @@ a<div>bc</div>de
 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
 (Parsoid-centric)
 !! options
-disabled
+parsoid
 !!input
 {|
 |{{echo|foo</table>}}
@@ -5995,7 +5997,7 @@ bar</span><span about="#mwt1">
 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
 (Parsoid-centric)
 !! options
-disabled
+parsoid
 !!input
 <table>
   <tr>
@@ -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
 <span title="Hello world>Foo</span>
 !! result
@@ -13729,7 +13731,7 @@ Table with broken attribute value quoting on consecutive lines
 !! test
 Parsoid-only: Table with broken attribute value quoting on consecutive lines
 !! options
-disabled
+parsoid
 !! input
 {|
 | title="Hello world|Foo
index 4d2c402..804a30c 100644 (file)
@@ -24,7 +24,7 @@
  * @ingroup Testing
  */
 
-$otions = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record', 'run-disabled' );
+$otions = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record', 'run-disabled', 'run-parsoid' );
 $optionsWithArgs = array( 'regex', 'filter', 'seed', 'setversion' );
 
 require_once( __DIR__ . '/../maintenance/commandLine.inc' );
@@ -53,6 +53,7 @@ Options:
   --seed <n>       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 );
index f8d0c37..bf6931a 100644 (file)
@@ -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();
index 1e51d80..02fcf24 100644 (file)
@@ -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