*/
/** */
+$optionsWithArgs = array('regex');
+
require_once( 'commandLine.inc' );
require_once( 'languages/LanguageUtf8.php' );
* @access public
*/
function ParserTest() {
+ global $options;
if( isset( $_SERVER['argv'] ) && in_array( '--color', $_SERVER['argv'] ) ) {
$this->color = true;
} elseif( isset( $_SERVER['argv'] ) && in_array( '--color=yes', $_SERVER['argv'] ) ) {
} else {
$this->showDiffs = true;
}
+
+ if (isset($options['regex'])) {
+ $this->regex = $options['regex'];
+ }
+ else {
+ # Matches anything
+ $this->regex = '';
+ }
}
/**
continue;
}
if( $section == 'end' ) {
- if (isset ($data['disabled'])) {
- # disabled test
- $data = array();
- $section = null;
- continue;
- }
if( !isset( $data['test'] ) ) {
die( "'end' without 'test' at line $n\n" );
}
else {
$data['options'] = $this->chomp( $data['options'] );
}
+ if (preg_match('/\\bdisabled\\b/i', $data['options'])
+ || !preg_match("/{$this->regex}/i", $data['test'])) {
+ # disabled test
+ $data = array();
+ $section = null;
+ continue;
+ }
if( $this->runTest(
$this->chomp( $data['test'] ),
$this->chomp( $data['input'] ),
$user =& new User();
$options =& ParserOptions::newFromUser( $user );
- if (preg_match('/math/i', $opts)) {
+ if (preg_match('/\\bmath\\b/i', $opts)) {
# XXX this should probably be done by the ParserOptions
require_once('Math.php');
$parser =& new Parser();
$title =& Title::makeTitle( NS_MAIN, $titleText );
- if (preg_match('/pst/i', $opts)) {
+ if (preg_match('/\\bpst\\b/i', $opts)) {
$out = $parser->preSaveTransform( $input, $title, $user, $options );
}
- else if (preg_match('/msg/i', $opts)) {
+ else if (preg_match('/\\bmsg\\b/i', $opts)) {
$out = $parser->transformMsg( $input, $options );
}
else {
$op = new OutputPage();
$op->replaceLinkHolders($out);
- if (preg_match('/ill/i', $opts)) {
+ if (preg_match('/\\bill\\b/i', $opts)) {
$out .= implode( ' ', $output->getLanguageLinks() );
}
- if (preg_match('/cat/i', $opts)) {
+ if (preg_match('/\\bcat\\b/i', $opts)) {
$out .= implode( ' ', $output->getCategoryLinks() );
}