From: Steve Hay Date: Tue, 13 Dec 2005 09:41:29 +0000 (+0000) Subject: Fix lib/File/Compare.t test failures on Win32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8974ce1ee942c407c5080e83810eaada482b2f0f;p=p5sagit%2Fp5-mst-13.2.git Fix lib/File/Compare.t test failures on Win32 Change 26225, updated by 26245, added a test for another filename with a trailing space but failed to open the new filehandle in binary mode To compound matters, creating a file called "foo " on Win32 "succeeds" but actually creates a file called just "foo", so we have actually overwritten the original file with this non-binary mode version, and hence some of the original tests started failing too! (And because of this the new test doesn't actually add anything new on Win32 at the moment, but right now I can't think of a filename that would have failed under 2-arg open but succeeds with 3-arg open, which was the purpose of this test) p4raw-id: //depot/perl@26337 --- diff --git a/lib/File/Compare.t b/lib/File/Compare.t index 504c789..8c369f4 100644 --- a/lib/File/Compare.t +++ b/lib/File/Compare.t @@ -79,8 +79,9 @@ eval { my $template = File::Spec->catfile(File::Spec->tmpdir, 'fcmpXXXX'); my($tfh,$filename) = mkstemp($template); # NB. The trailing space is intentional (see [perl #37716]) - open my $tfhCR, ">", "$filename " - or die "Could no open '$filename^M' for writing: $!"; + open my $tfhSP, ">", "$filename " + or die "Could not open '$filename ' for writing: $!"; + binmode($tfhSP); { local $/; #slurp my $fh; @@ -89,8 +90,8 @@ eval { my $data = <$fh>; print $tfh $data; close($fh); - print $tfhCR $data; - close($tfhCR); + print $tfhSP $data; + close($tfhSP); } seek($tfh,0,0); $donetests[0] = compare($tfh, 'README');