From: Happy-melon Date: Sun, 16 Jan 2011 23:43:15 +0000 (+0000) Subject: Fix diff output for failed tests on windows, which typically doesn't have a 'diff... X-Git-Tag: 1.31.0-rc.0~32507 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=12d0cb6aa301dbbc01c7c6432ca96f2165ac3c46;p=lhc%2Fweb%2Fwiklou.git Fix diff output for failed tests on windows, which typically doesn't have a 'diff' command; use 'fc' instead. --- diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 84f1d52f7a..faca6c7811 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -1063,7 +1063,9 @@ class ParserTest { * @return String */ protected function quickDiff( $input, $output, $inFileTail = 'expected', $outFileTail = 'actual' ) { - $prefix = wfTempDir() . "/mwParser-" . mt_rand(); + # Windows, or at least the fc utility, is retarded + $slash = wfIsWindows() ? '\\' : '/'; + $prefix = wfTempDir() . "{$slash}mwParser-" . mt_rand(); $infile = "$prefix-$inFileTail"; $this->dumpToFile( $input, $infile ); @@ -1071,7 +1073,12 @@ class ParserTest { $outfile = "$prefix-$outFileTail"; $this->dumpToFile( $output, $outfile ); - $diff = `diff -au $infile $outfile`; + $shellInfile = wfEscapeShellArg($infile); + $shellOutfile = wfEscapeShellArg($outfile); + + $diff = wfIsWindows() + ? `fc $shellInfile $shellOutfile` + : `diff -au $shellInfile $shellOutfile`; unlink( $infile ); unlink( $outfile );