diff options
author | Brion Vibber <brion@users.mediawiki.org> | 2007-01-12 00:35:26 +0000 |
---|---|---|
committer | Brion Vibber <brion@users.mediawiki.org> | 2007-01-12 00:35:26 +0000 |
commit | 7e3a05ecb0dc43e45988bd70a1bd108b76fb9927 (patch) | |
tree | 50edd4ef9ae83371fa9ada3b4614fb927522020b /maintenance/parserTests.inc | |
parent | 03d97f003ae9f74848788a12f11c91048662039c (diff) | |
download | mediawikicore-7e3a05ecb0dc43e45988bd70a1bd108b76fb9927.tar.gz mediawikicore-7e3a05ecb0dc43e45988bd70a1bd108b76fb9927.zip |
Pretty up parser test output:
* include old failing tests in --record output, at the end of the changed items
* suppress failure notices during run if --record and --quiet are both specified, so they're not duped
* show relative paths for the test input files
* moved FiveUpgrade::relativize() to wfRelativePath() for wider use; using DIRECTORY_SEPARATOR instead of '/' but might explode on windows, haven't tried it ;) won't handle different drives/UNC servers right, probably
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/19136
Diffstat (limited to 'maintenance/parserTests.inc')
-rw-r--r-- | maintenance/parserTests.inc | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index ca8d578b4c5f..94b0982f3ca5 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -90,7 +90,11 @@ class ParserTest { : new DummyTermColorer(); $this->showDiffs = !isset( $options['quick'] ); - $this->quiet = isset( $options['quiet'] ); + $this->showProgress = !isset( $options['quiet'] ); + $this->showFailure = !( + isset( $options['quiet'] ) + && isset( $options['record'] ) ); // redundant output + $this->showOutput = isset( $options['show-output'] ); @@ -152,8 +156,10 @@ class ParserTest { if( !$infile ) { wfDie( "Couldn't open $filename\n" ); } else { + global $IP; + $relative = wfRelativePath( $filename, $IP ); print $this->term->color( 1 ) . - "Reading tests from \"$filename\"..." . + "Reading tests from \"$relative\"..." . $this->term->reset() . "\n"; } @@ -264,7 +270,7 @@ class ParserTest { * @return bool */ function runTest( $desc, $input, $result, $opts ) { - if( !$this->quiet ) { + if( $this->showProgress ) { $this->showTesting( $desc ); } @@ -646,7 +652,7 @@ class ParserTest { * @private */ function showSuccess( $desc ) { - if( !$this->quiet ) { + if( $this->showProgress ) { print $this->term->color( '1;32' ) . 'PASSED' . $this->term->reset() . "\n"; } return true; @@ -663,19 +669,21 @@ class ParserTest { * @private */ function showFailure( $desc, $result, $html ) { - if( $this->quiet ) { - # In quiet mode we didn't show the 'Testing' message before the - # test, in case it succeeded. Show it now: - $this->showTesting( $desc ); - } - print $this->term->color( '1;31' ) . 'FAILED!' . $this->term->reset() . "\n"; - if ( $this->showOutput ) { - print "--- Expected ---\n$result\n--- Actual ---\n$html\n"; - } - if( $this->showDiffs ) { - print $this->quickDiff( $result, $html ); - if( !$this->wellFormed( $html ) ) { - print "XML error: $this->mXmlError\n"; + if( $this->showFailure ) { + if( !$this->showProgress ) { + # In quiet mode we didn't show the 'Testing' message before the + # test, in case it succeeded. Show it now: + $this->showTesting( $desc ); + } + print $this->term->color( '1;31' ) . 'FAILED!' . $this->term->reset() . "\n"; + if ( $this->showOutput ) { + print "--- Expected ---\n$result\n--- Actual ---\n$html\n"; + } + if( $this->showDiffs ) { + print $this->quickDiff( $result, $html ); + if( !$this->wellFormed( $html ) ) { + print "XML error: $this->mXmlError\n"; + } } } return false; @@ -1010,6 +1018,7 @@ class DbTestRecorder extends TestRecorder { array( 'previously passing test(s) now FAILING! :(', 1, 0 ), array( 'previously FAILING test(s) removed O_o', 0, null ), array( 'new FAILING test(s) :(', null, 0 ), + array( 'still FAILING test(s) :(', 0, 0 ), ); foreach( $table as $criteria ) { list( $label, $before, $after ) = $criteria; |