r80429 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80428‎ | r80429 | r80430 >
Date:23:43, 16 January 2011
Author:happy-melon
Status:ok
Tags:
Comment:
Fix diff output for failed tests on windows, which typically doesn't have a 'diff' command; use 'fc' instead.
Modified paths:
  • /trunk/phase3/tests/parser/parserTest.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/parser/parserTest.inc
@@ -1063,7 +1063,9 @@
10641064 * @return String
10651065 */
10661066 protected function quickDiff( $input, $output, $inFileTail = 'expected', $outFileTail = 'actual' ) {
1067 - $prefix = wfTempDir() . "/mwParser-" . mt_rand();
 1067+ # Windows, or at least the fc utility, is retarded
 1068+ $slash = wfIsWindows() ? '\\' : '/';
 1069+ $prefix = wfTempDir() . "{$slash}mwParser-" . mt_rand();
10681070
10691071 $infile = "$prefix-$inFileTail";
10701072 $this->dumpToFile( $input, $infile );
@@ -1071,7 +1073,12 @@
10721074 $outfile = "$prefix-$outFileTail";
10731075 $this->dumpToFile( $output, $outfile );
10741076
1075 - $diff = `diff -au $infile $outfile`;
 1077+ $shellInfile = wfEscapeShellArg($infile);
 1078+ $shellOutfile = wfEscapeShellArg($outfile);
 1079+
 1080+ $diff = wfIsWindows()
 1081+ ? `fc $shellInfile $shellOutfile`
 1082+ : `diff -au $shellInfile $shellOutfile`;
10761083 unlink( $infile );
10771084 unlink( $outfile );
10781085

Status & tagging log