diff options
author | Peter Prymmer <PPrymmer@factset.com> | 2003-07-22 07:12:05 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-07-29 13:11:57 +0000 |
commit | 3cd78934808a82741e51acd368597edf04f54641 (patch) | |
tree | 20220dd7eafae1028897244e09059571654d4367 /ext/Encode | |
parent | 78c56a8ce71edce32bfc096b248fc7fdd8188919 (diff) | |
download | perl-3cd78934808a82741e51acd368597edf04f54641.tar.gz |
Encode test fixes for VMS (was Re: possible fix to File::Find problems)
Message-ID: <OFBD4A7559.D7CF9517-ON85256D6B.00534853-85256D6B.00538131@factset.com>
p4raw-id: //depot/perl@20310
Diffstat (limited to 'ext/Encode')
-rw-r--r-- | ext/Encode/t/enc_eucjp.t | 18 | ||||
-rw-r--r-- | ext/Encode/t/enc_utf8.t | 18 | ||||
-rw-r--r-- | ext/Encode/t/perlio.t | 5 |
3 files changed, 32 insertions, 9 deletions
diff --git a/ext/Encode/t/enc_eucjp.t b/ext/Encode/t/enc_eucjp.t index 3d5457d54f..3afeb5d5f5 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, "<f$i") or die "$0: failed to open 'f$i' for reading: $!"; + my $file = filename("f$i"); + open(F, "<$file") or die "$0: failed to open '$file' for reading: $!"; binmode(F, ":utf8"); my $c = <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 98e541c51c..e12e35de1a 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, "<f$i") or die "$0: failed to open 'f$i' for reading: $!"; + my $file = filename("f$i"); + open(F, "<$file") or die "$0: failed to open '$file' for reading: $!"; binmode(F, ":utf8"); my $c = <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 bc1ce1f971..1b1de895a0 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; + } } } |