summaryrefslogtreecommitdiff
path: root/t/lib/ftmp-tempfile.t
diff options
context:
space:
mode:
authorTim Jenness <tjenness@cpan.org>2000-11-24 08:38:34 -1000
committerJarkko Hietaniemi <jhi@iki.fi>2000-11-26 18:28:09 +0000
commit09d7a2f981f65aa2b3e19acb026791af31c51942 (patch)
tree6ead27663fb7beefe7bd94cc6b636726bce7e074 /t/lib/ftmp-tempfile.t
parentd50de4df9588ea188152311c7cd345f973ea66ed (diff)
downloadperl-09d7a2f981f65aa2b3e19acb026791af31c51942.tar.gz
PATCH: File::Temp fix on WindowsNT/VMS
Message-ID: <Pine.LNX.4.21.0011241833230.18423-100000@lapaki.jach.hawaii.edu> File::Temp 0.11. p4raw-id: //depot/perl@7866
Diffstat (limited to 't/lib/ftmp-tempfile.t')
-rwxr-xr-xt/lib/ftmp-tempfile.t30
1 files changed, 29 insertions, 1 deletions
diff --git a/t/lib/ftmp-tempfile.t b/t/lib/ftmp-tempfile.t
index 48a52b3c92..ed59765a75 100755
--- a/t/lib/ftmp-tempfile.t
+++ b/t/lib/ftmp-tempfile.t
@@ -5,7 +5,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require Test; import Test;
- plan(tests => 16);
+ plan(tests => 20);
}
use strict;
@@ -51,6 +51,10 @@ my ($fh, $tempfile) = tempfile(
);
ok( (-f $tempfile) );
+# Should still be around after closing
+ok( close( $fh ) );
+ok( (-f $tempfile) );
+# Check again at exit
push(@files, $tempfile);
# TEMPDIR test
@@ -113,5 +117,29 @@ ok( -f $tempfile );
ok( close( $fh ) );
push( @still_there, $tempfile); # check at END
+# Would like to create a temp file and just retrieve the handle
+# but the test is problematic since:
+# - We dont know the filename so we cant check that it is tidied
+# correctly
+# - The unlink0 required on unix for tempfile creation will fail
+# on NFS
+# Try to do what we can.
+# Tempfile croaks on error so we need an eval
+$fh = eval { tempfile( 'ftmpXXXXX', DIR => File::Spec->tmpdir ) };
+
+if ($fh) {
+
+ # print something to it to make sure something is there
+ ok( print $fh "Test\n" );
+
+ # Close it - can not check it is gone since we dont know the name
+ ok( close($fh) );
+
+} else {
+ skip "Skip Failed probably due to NFS", 1;
+ skip "Skip Failed probably due to NFS", 1;
+}
+
# Now END block will execute to test the removal of directories
+print "# End of tests. Execute END blocks\n";