From 7bb2abb34e1acd84425f9bb465aee3d14888fb67 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Fri, 9 Jul 2010 21:11:54 +0000 Subject: [PATCH] Follow-up to r67044: moved string function tests to a separate file protected by conditional, tweaked test runner to skip instead of exploding when required function hook is not found. --- maintenance/parserTests.inc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index eb00f0c7c7..916141f534 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -1049,9 +1049,10 @@ class ParserTest { /** * Steal a callback function from the primary parser, save it for * application to our scary parser. If the hook is not installed, - * die a painful dead to warn the others. + * abort processing of this file. * * @param $name String + * @return Bool true if tag hook is present */ public function requireHook( $name ) { global $wgParser; @@ -1059,16 +1060,19 @@ class ParserTest { if ( isset( $wgParser->mTagHooks[$name] ) ) { $this->hooks[$name] = $wgParser->mTagHooks[$name]; } else { - wfDie( "This test suite requires the '$name' hook extension.\n" ); + echo " This test suite requires the '$name' hook extension, skipping.\n"; + return false; } + return true; } /** * Steal a callback function from the primary parser, save it for * application to our scary parser. If the hook is not installed, - * die a painful dead to warn the others. + * abort processing of this file. * * @param $name String + * @return Bool true if function hook is present */ public function requireFunctionHook( $name ) { global $wgParser; @@ -1076,8 +1080,10 @@ class ParserTest { if ( isset( $wgParser->mFunctionHooks[$name] ) ) { $this->functionHooks[$name] = $wgParser->mFunctionHooks[$name]; } else { - wfDie( "This test suite requires the '$name' function hook extension.\n" ); + echo " This test suite requires the '$name' function hook extension, skipping.\n"; + return false; } + return true; } /* @@ -1657,7 +1663,9 @@ class TestFileIterator implements Iterator { foreach ( explode( "\n", $data['hooks'] ) as $line ) { $line = trim( $line ); if ( $line ) { - if ( $this->parser ) $this->parser->requireHook( $line ); + if ( $this->parser && !$this->parser->requireHook( $line ) ) { + return false; + } } } $data = array(); @@ -1671,7 +1679,9 @@ class TestFileIterator implements Iterator { foreach ( explode( "\n", $data['functionhooks'] ) as $line ) { $line = trim( $line ); if ( $line ) { - if ( $this->parser ) $this->parser->requireFunctionHook( $line ); + if ( $this->parser && !$this->parser->requireFunctionHook( $line ) ) { + return false; + } } } $data = array(); -- 2.20.1