This is how i would do that:
use strict; use warnings; use File::Temp qw( tempdir ); use Test::More tests => 2; my $fname = 'foo.txt'; my $dir = tempdir( CLEANUP => 1 ); is -f "$dir/$fname", undef, "file does not exit"; create_file( $dir, $fname ); is -f "$dir/$fname", 1, "file now exists"; sub create_file { my ($path, $fname) = @_; open FH, '>', "$path/$fname" or die "$!\n"; close FH; }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Unit test - check file created using test::directory
by jeffa
in thread Unit test - check file created using test::directory
by APGRMF
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |