summaryrefslogtreecommitdiff
path: root/t/test_pl
diff options
context:
space:
mode:
authorBrad Gilbert <b2gills@gmail.com>2014-02-04 11:55:28 -0600
committerTony Cook <tony@develop-help.com>2014-02-13 13:53:28 +1100
commit19e0609373507a377a6763b156aa35dcbbfeeec6 (patch)
treed3859fc85ad0163430cfe33b8b2147e8cce7e6cd /t/test_pl
parent5eccd97ae65fe4e91991cec8d8034c09786096c4 (diff)
downloadperl-19e0609373507a377a6763b156aa35dcbbfeeec6.tar.gz
Make sure that tempfile() in t/test.pl removes the temp files
Run a program within t/test_pl/tempfile.t that uses tempfile() to make sure that the temp file is removed when the tests are done.
Diffstat (limited to 't/test_pl')
-rw-r--r--t/test_pl/tempfile.t15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/test_pl/tempfile.t b/t/test_pl/tempfile.t
index 881ecbf566..d507d60642 100644
--- a/t/test_pl/tempfile.t
+++ b/t/test_pl/tempfile.t
@@ -75,4 +75,19 @@ ok( !eval{tempfile()}, 'Should bail after Last available filename' );
my $err = "$@";
like( $err, qr{^Can't find temporary file name starting}, 'check error string' );
+{
+ my $returned = runperl( progs => [
+ 'require q[./test.pl];',
+ 'my $t = tempfile();',
+ 'print qq[$t|];',
+ 'print open(FH,q[>],$t) ? qq[ok|] : qq[not ok|] ;',
+ 'print -e $t ? qq[ok|] : qq[not ok|];',
+ ] );
+ my($filename,$opened,$existed) = split /\|/, $returned;
+
+ is( $opened, 'ok', "$filename created" );
+ is( $existed, 'ok', "$filename did exist" );
+ ok( !-e $filename, "$filename doesn't exist now" );
+}
+
done_testing();