summaryrefslogtreecommitdiff
path: root/t/io
diff options
context:
space:
mode:
authorNiko Tyni <ntyni@debian.org>2009-06-10 08:32:42 -0500
committerSteve Peters <steve@fisharerojo.org>2009-06-10 08:32:42 -0500
commit26e8050aaf2eeca2f04cdc7bc5df07f8dc4ff0f9 (patch)
treea00b11d8470d3ec8f9c85aa155111f962f7d1dd7 /t/io
parentaf6a0f9e3d4aacb66f6fd0d20aa527ab7d9a9032 (diff)
downloadperl-26e8050aaf2eeca2f04cdc7bc5df07f8dc4ff0f9.tar.gz
[perl #66452] TMPDIR not honored when opening an anonymous temporary file
Diffstat (limited to 't/io')
-rw-r--r--t/io/perlio.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/t/io/perlio.t b/t/io/perlio.t
index c1459452ef..8d76d91a2d 100644
--- a/t/io/perlio.t
+++ b/t/io/perlio.t
@@ -8,13 +8,14 @@ BEGIN {
}
}
-use Test::More tests => 37;
+use Test::More tests => 39;
use_ok('PerlIO');
my $txt = "txt$$";
my $bin = "bin$$";
my $utf = "utf$$";
+my $nonexistent = "nex$$";
my $txtfh;
my $binfh;
@@ -89,6 +90,17 @@ ok(close($utffh));
# report after STDOUT is restored
ok($status, ' re-open STDOUT');
close OLDOUT;
+
+ SKIP: {
+ skip("TMPDIR not honored on this platform", 2)
+ if !$Config{d_mkstemp}
+ || $^O eq 'VMS' || $^O eq 'MSwin32' || $^O eq 'os2';
+ local $ENV{TMPDIR} = $nonexistent;
+ ok( !open(my $x,"+<",undef), 'TMPDIR honored by magic temp file via 3 arg open with undef - fails if TMPDIR points to a non-existent dir');
+
+ mkdir $ENV{TMPDIR};
+ ok(open(my $x,"+<",undef), 'TMPDIR honored by magic temp file via 3 arg open with undef - works if TMPDIR points to an existent dir');
+ }
}
# in-memory open
@@ -136,5 +148,6 @@ END {
1 while unlink $txt;
1 while unlink $bin;
1 while unlink $utf;
+ 1 while rmdir $nonexistent;
}