Allow parsoid-compatible parser tests to select a subset of parsoid modes

This lets you tag a parser test file with:

  !! options
  parsoid-compatible=wt2html
  !! end

to indicate that you want to run only the parsoid wt2html tests on
this file.  This is especially useful when gradually adding
integrated-mode parsoid output clauses to an existing test file.

Change-Id: Id870d23da3c127fea61d6b8ab98200c0e4c661e2
This commit is contained in:
C. Scott Ananian 2022-08-12 14:36:56 -04:00 committed by C. Scott Ananian
parent 694982e62b
commit 02d13afa7e

View file

@ -49,6 +49,14 @@ class ParsoidTestFileSuite extends TestSuite {
$validTestModes = $this->ptRunner->getRequestedTestModes();
$skipMode = new ParserTestMode( $validTestModes[0] );
$modeRestriction = $this->ptFileInfo->fileOptions['parsoid-compatible'] ?? false;
if ( $modeRestriction !== false ) {
if ( is_string( $modeRestriction ) ) {
// shorthand
$modeRestriction = [ $modeRestriction ];
}
$validTestModes = array_intersect( $validTestModes, $modeRestriction );
}
$suite = $this;
foreach ( $this->ptFileInfo->testCases as $t ) {