X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FFile%2FCompare.t;h=2685077b36261c99a1b2b8e73d47bbbc09c15985;hb=bfbf02a1bb78f5006578304da872a3d29b074c1f;hp=c52d87303ae5fa091ee7f80b1d2b091d96f8168f;hpb=d569369663d5f1104f258f47a91ede9f4feb155e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/File/Compare.t b/lib/File/Compare.t index c52d873..2685077 100644 --- a/lib/File/Compare.t +++ b/lib/File/Compare.t @@ -78,8 +78,10 @@ eval { my $template = File::Spec->catfile(File::Spec->tmpdir, 'fcmpXXXX'); my($tfh,$filename) = mkstemp($template); - open my $tfhCR, ">", "$filename\cM" - or die "Could no open '$filename^M' for writing: $!"; + # NB. The trailing space is intentional (see [perl #37716]) + open my $tfhSP, ">", "$filename " + or die "Could not open '$filename ' for writing: $!"; + binmode($tfhSP); { local $/; #slurp my $fh; @@ -88,35 +90,28 @@ 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'); $donetests[1] = compare($filename, 'README'); unlink0($tfh,$filename); - $donetests[2] = compare('README', "$filename\cM"); - unlink "$filename\cM"; + $donetests[2] = compare('README', "$filename "); + unlink "$filename "; }; print "# problem '$@' when testing with a temporary file\n" if $@; if (@donetests == 3) { print "not " unless $donetests[0] == 0; print "ok 11 # fh/file [$donetests[0]]\n"; - if ($^O eq 'VMS') { - # The open attempt on FROM in File::Compare::compare should fail - # on this OS since files are not shared by default. - print "not " unless $donetests[1] == -1; - print "ok 12 # file/file [$donetests[1]]\n"; - } - else { - print "not " unless $donetests[1] == 0; - print "ok 12 # file/file [$donetests[1]]\n"; - } + print "not " unless $donetests[1] == 0; + print "ok 12 # file/file [$donetests[1]]\n"; print "not " unless $donetests[2] == 0; - print "ok 13 # file/fileCR [$donetests[2]]\n"; + print "ok 13 # "; + print "TODO" if $^O eq "cygwin"; # spaces after filename silently trunc'd + print " file/fileCR [$donetests[2]]\n"; } else { print "ok 11# Skip\nok 12 # Skip\nok 13 # Skip Likely due to File::Temp\n"; } -