From 12d0cb6aa301dbbc01c7c6432ca96f2165ac3c46 Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Sun, 16 Jan 2011 23:43:15 +0000 Subject: [PATCH] Fix diff output for failed tests on windows, which typically doesn't have a 'diff' command; use 'fc' instead. --- tests/parser/parserTest.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 ); -- 2.20.1