From: Peter Prymmer Date: Tue, 22 Jul 2003 11:12:05 +0000 (-0400) Subject: Encode test fixes for VMS (was Re: possible fix to File::Find problems) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3cd78934808a82741e51acd368597edf04f54641;p=p5sagit%2Fp5-mst-13.2.git Encode test fixes for VMS (was Re: possible fix to File::Find problems) Message-ID: p4raw-id: //depot/perl@20310 --- diff --git a/ext/Encode/t/enc_eucjp.t b/ext/Encode/t/enc_eucjp.t index 3d5457d..3afeb5d 100644 --- a/ext/Encode/t/enc_eucjp.t +++ b/ext/Encode/t/enc_eucjp.t @@ -31,8 +31,9 @@ my @f; for my $i (0..$#c) { no warnings 'pack'; - push @f, "f$i"; - open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!"; + my $file = filename("f$i"); + push @f, $file; + open(F, ">$file") or die "$0: failed to open '$file' for writing: $!"; binmode(F, ":utf8"); print F chr($c[$i]); print F pack("C" => $c[$i]); @@ -42,7 +43,8 @@ for my $i (0..$#c) { my $t = 1; for my $i (0..$#c) { - open(F, "; my $o = ord($c); @@ -50,7 +52,7 @@ for my $i (0..$#c) { $t++; } -my $f = "f" . @f; +my $f = filename("f" . @f); push @f, $f; open(F, ">$f") or die "$0: failed to open '$f' for writing: $!"; @@ -68,6 +70,14 @@ close F; print $a =~ qr{^utf8 "\\x80" does not map to Unicode} ? "ok $t - illegal utf8 input\n" : "not ok $t - illegal utf8 input: a = " . unpack("H*", $a) . "\n"; +# On VMS temporary file names like "f0." may be more readable than "f0" since +# "f0" could be a logical name pointing elsewhere. +sub filename { + my $name = shift; + $name .= '.' if $^O eq 'VMS'; + return $name; +} + END { 1 while unlink @f; } diff --git a/ext/Encode/t/enc_utf8.t b/ext/Encode/t/enc_utf8.t index 98e541c..e12e35d 100644 --- a/ext/Encode/t/enc_utf8.t +++ b/ext/Encode/t/enc_utf8.t @@ -26,8 +26,9 @@ print "1.." . (scalar @c + 1) . "\n"; my @f; for my $i (0..$#c) { - push @f, "f$i"; - open(F, ">f$i") or die "$0: failed to open 'f$i' for writing: $!"; + my $file = filename("f$i"); + push @f, $file; + open(F, ">$file") or die "$0: failed to open '$file' for writing: $!"; binmode(F, ":utf8"); print F chr($c[$i]); close F; @@ -36,7 +37,8 @@ for my $i (0..$#c) { my $t = 1; for my $i (0..$#c) { - open(F, "; my $o = ord($c); @@ -44,7 +46,7 @@ for my $i (0..$#c) { $t++; } -my $f = "f" . @f; +my $f = filename("f" . @f); push @f, $f; open(F, ">$f") or die "$0: failed to open '$f' for writing: $!"; @@ -62,6 +64,14 @@ close F; print $a =~ qr{^utf8 "\\x80" does not map to Unicode} ? "ok $t - illegal utf8 input\n" : "not ok $t - illegal utf8 input: a = " . unpack("H*", $a) . "\n"; +# On VMS temporary file names like "f0." may be more readable than "f0" since +# "f0" could be a logical name pointing elsewhere. +sub filename { + my $name = shift; + $name .= '.' if $^O eq 'VMS'; + return $name; +} + END { 1 while unlink @f; } diff --git a/ext/Encode/t/perlio.t b/ext/Encode/t/perlio.t index bc1ce1f..1b1de89 100644 --- a/ext/Encode/t/perlio.t +++ b/ext/Encode/t/perlio.t @@ -122,7 +122,10 @@ for my $src (sort keys %e) { dump2file("$pfile.$seq", $dtext); } } - $DEBUG or unlink ($sfile, $pfile); + unless ( $DEBUG ) { + 1 while unlink $sfile; + 1 while unlink $pfile; + } } }