From: Jerry D. Hedden Date: Tue, 16 Sep 2008 16:35:11 +0000 (-0400) Subject: Don't reuse temp files in tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f89542f789fc8ac88f7cd7e93bb8d9cd6228182b;p=p5sagit%2Fp5-mst-13.2.git Don't reuse temp files in tests From: "Jerry D. Hedden" Message-ID: <1ff86f510809161335j73312da3v90fa6ef0cb8ac7c@mail.gmail.com> Date: Tue, 16 Sep 2008 16:35:11 -0400 p4raw-id: //depot/perl@34377 --- diff --git a/lib/charnames.t b/lib/charnames.t index 4889562..5a6671b 100644 --- a/lib/charnames.t +++ b/lib/charnames.t @@ -271,10 +271,8 @@ print "ok 46\n"; # ---- Alias extensions -my $tmpfile = tempfile(); my $alifile = File::Spec->catfile(File::Spec->updir, qw(lib unicore xyzzy_alias.pl)); my $i = 0; -END { if ($tmpfile) { 1 while unlink $tmpfile; } } my @prgs; { local $/ = undef; @@ -285,6 +283,7 @@ my $i = 46; for (@prgs) { my ($code, $exp) = ((split m/\nEXPECT\n/), '$'); my ($prog, $fil) = ((split m/\nFILE\n/, $code), ""); + my $tmpfile = tempfile(); open my $tmp, "> $tmpfile" or die "Could not open $tmpfile: $!"; print $tmp $prog, "\n"; close $tmp or die "Could not close $tmpfile: $!"; @@ -322,7 +321,6 @@ for (@prgs) { print "not "; } print "ok ", ++$i, "\n"; - 1 while unlink $tmpfile; $fil or next; 1 while unlink $alifile; } diff --git a/lib/strict.t b/lib/strict.t index 1176be8..bfe6b63 100644 --- a/lib/strict.t +++ b/lib/strict.t @@ -12,9 +12,7 @@ $| = 1; my $Is_VMS = $^O eq 'VMS'; my $Is_MSWin32 = $^O eq 'MSWin32'; my $Is_NetWare = $^O eq 'NetWare'; -my $tmpfile = tempfile(); my $i = 0 ; -END { if ($tmpfile) { 1 while unlink $tmpfile; } } my @prgs = () ; @@ -65,6 +63,7 @@ for (@prgs){ $prog = shift @files ; $prog =~ s|\./abc|:abc|g if $^O eq 'MacOS'; } + my $tmpfile = tempfile(); open TEST, ">$tmpfile" or die "Could not open: $!"; print TEST $prog,"\n"; close TEST or die "Could not close: $!"; diff --git a/lib/subs.t b/lib/subs.t index 7952c20..b1999b2 100644 --- a/lib/subs.t +++ b/lib/subs.t @@ -16,9 +16,7 @@ my $Is_VMS = $^O eq 'VMS'; my $Is_MSWin32 = $^O eq 'MSWin32'; my $Is_NetWare = $^O eq 'NetWare'; my $Is_MacOS = $^O eq 'MacOS'; -my $tmpfile = tempfile(); my $i = 0 ; -END { if ($tmpfile) { 1 while unlink $tmpfile} } for (@prgs){ my $switch = ""; @@ -44,6 +42,7 @@ for (@prgs){ shift @files ; $prog = shift @files ; } + my $tmpfile = tempfile(); open TEST, ">$tmpfile"; print TEST $prog,"\n"; close TEST;