summaryrefslogtreecommitdiff
path: root/t/io
diff options
context:
space:
mode:
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;
}