From: Brad Gilbert Date: Tue, 4 Feb 2014 17:55:28 +0000 (-0600) Subject: Make sure that tempfile() in t/test.pl removes the temp files X-Git-Tag: upstream/5.20.0~433^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19e0609373507a377a6763b156aa35dcbbfeeec6;p=platform%2Fupstream%2Fperl.git 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. --- diff --git a/t/test_pl/tempfile.t b/t/test_pl/tempfile.t index 881ecbf..d507d60 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();