]> granicus.if.org Git - php/commitdiff
- Tidy up loose ends in diff and exp output
authorSteph Fox <sfox@php.net>
Thu, 12 Jun 2008 12:02:01 +0000 (12:02 +0000)
committerSteph Fox <sfox@php.net>
Thu, 12 Jun 2008 12:02:01 +0000 (12:02 +0000)
- All test output now has *nix line endings (only diffs didn't in 5_3)

run-tests.php

index 69e0eb4d3281d94f45b255015f25b0e577fdef2e..ec8e5e4393424509e1d558892b3cef81e471ab77 100755 (executable)
@@ -1783,7 +1783,7 @@ COMMAND $cmd
        if (!$passed) {
 
                // write .exp
-               if (strpos($log_format, 'E') !== false && file_put_contents($exp_filename, $wanted) === false) {
+               if (strpos($log_format, 'E') !== false && file_put_contents($exp_filename, (binary)$wanted, FILE_BINARY) === false) {
                        error("Cannot create expected test output - $exp_filename");
                }
 
@@ -1796,7 +1796,7 @@ COMMAND $cmd
                $diff = generate_diff($wanted, $wanted_re, $output);
                show_file_block('diff', $diff);
 
-               if (strpos($log_format, 'D') !== false && file_put_contents($diff_filename, $diff) === false) {
+               if (strpos($log_format, 'D') !== false && file_put_contents($diff_filename, (binary)$diff, FILE_BINARY) === false) {
                        error("Cannot create test diff - $diff_filename");
                }
 
@@ -2008,10 +2008,10 @@ function generate_diff($wanted, $wanted_re, $output)
        $diff = generate_array_diff($r, $o, !is_null($wanted_re), $w);
 
        if (is_binary($output)) {
-               return implode(b"\r\n", $diff);
+               return implode(b"\n", $diff);
        }
 
-       return implode("\r\n", $diff);
+       return implode("\n", $diff);
 }
 
 function error($message)