~ubuntu-branches/ubuntu/saucy/mediawiki-extensions/saucy

« back to all changes in this revision

Viewing changes to dist/mediawiki-extensions-base/usr/share/doc/mediawiki-extensions/base/ParserFunctions/testExpr.php

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2010-05-04 15:13:35 UTC
  • mfrom: (0.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100504151335-54qeucg3ec108q28
Tags: 2.2
* Added Replaces:/Conflicts: to allow a proper upgrade.
Closes: #580066
* Fixed package descriptions.
Closes: #579667
* Patched mediawiki-extensions-fckeditor to make it work with
  php 5.3. The fix may not be perfect but at least it work.
  Not closing the bug (#579822) for now..

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
require_once ( getenv('MW_INSTALL_PATH') !== false
 
4
        ? getenv('MW_INSTALL_PATH')."/maintenance/commandLine.inc"
 
5
        : dirname( __FILE__ ) . '/../../maintenance/commandLine.inc' );
 
6
require( 'Expr.php' );
 
7
        
 
8
$tests = file( 'exprTests.txt' );
 
9
 
 
10
$pass = $fail = 0;
 
11
 
 
12
// Each test is on one line. The test must always evaluate to '1'.
 
13
$parser = new ExprParser;
 
14
foreach( $tests as $test ) {
 
15
        $test = trim($test);
 
16
        if ( in_string( ';', $test ) )
 
17
                list($input,$expected) = explode(';', $test);
 
18
        else {
 
19
                $input = $test;
 
20
                $expected = 1;
 
21
        }
 
22
        
 
23
        $expected = trim($expected);
 
24
        $input = trim($input);
 
25
 
 
26
        $result = $parser->doExpression( $input );
 
27
        if ($result != $expected) {
 
28
                print
 
29
                        "FAILING test -- $input
 
30
 gave a final result of $result, instead of $expected.\n";
 
31
                $fail++;
 
32
        } else {
 
33
                print "PASSED test $test\n";
 
34
                $pass++;
 
35
        }
 
36
}
 
37
 
 
38
print "Passed $pass tests, failed $fail tests, out of a total of ".($pass+$fail)."\n";
 
 
b'\\ No newline at end of file'