Index: trunk/phase3/includes/parser/Parser_DiffTest.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | class Parser_DiffTest |
8 | 8 | { |
9 | 9 | var $parsers, $conf; |
| 10 | + var $shortOutput = false; |
10 | 11 | |
11 | 12 | var $dfUniqPrefix; |
12 | 13 | |
— | — | @@ -28,6 +29,9 @@ |
29 | 30 | $doneHook = true; |
30 | 31 | $wgHooks['ParserClearState'][] = array( $this, 'onClearState' ); |
31 | 32 | } |
| 33 | + if ( isset( $this->conf['shortOutput'] ) ) { |
| 34 | + $this->shortOutput = $this->conf['shortOutput']; |
| 35 | + } |
32 | 36 | |
33 | 37 | foreach ( $this->conf['parsers'] as $i => $parserConf ) { |
34 | 38 | if ( !is_array( $parserConf ) ) { |
— | — | @@ -66,12 +70,23 @@ |
67 | 71 | } |
68 | 72 | if ( $mismatch ) { |
69 | 73 | throw new MWException( "Parser_DiffTest: results mismatch on call to $name\n" . |
70 | | - 'Arguments: ' . var_export( $args, true ) . "\n" . |
71 | | - 'Results: ' . var_export( $results, true ) . "\n" ); |
| 74 | + 'Arguments: ' . $this->formatArray( $args ) . "\n" . |
| 75 | + 'Results: ' . $this->formatArray( $results ) . "\n" ); |
72 | 76 | } |
73 | 77 | return $lastResult; |
74 | 78 | } |
75 | 79 | |
| 80 | + function formatArray( $array ) { |
| 81 | + if ( $this->shortOutput ) { |
| 82 | + foreach ( $array as $key => $value ) { |
| 83 | + if ( $value instanceof ParserOutput ) { |
| 84 | + $array[$key] = "ParserOutput: {$value->getText()}"; |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | + return var_export( $array, true ); |
| 89 | + } |
| 90 | + |
76 | 91 | function setFunctionHook( $id, $callback, $flags = 0 ) { |
77 | 92 | $this->init(); |
78 | 93 | foreach ( $this->parsers as $i => $parser ) { |