M: Improved and extended unit tests.
This commit is contained in:
29
t/2.t
Normal file
29
t/2.t
Normal file
@@ -0,0 +1,29 @@
|
||||
use Test::More qw(no_plan);
|
||||
use Test::Exception;
|
||||
|
||||
use File::Basename;
|
||||
|
||||
BEGIN { use_ok( 'File::DirWalk' ); }
|
||||
require_ok( 'File::DirWalk' );
|
||||
|
||||
ok(-e "t/");
|
||||
ok(-d "t/");
|
||||
|
||||
foreach my $f qw(1.t 2.t 3.t 4.t) {
|
||||
$dw = new File::DirWalk();
|
||||
$dw->setDepth(1);
|
||||
|
||||
$dw->onFile(sub {
|
||||
my ($path) = @_;
|
||||
ok(-e $path);
|
||||
ok(-f $path);
|
||||
|
||||
if ($dw->currentBasename() eq $f) {
|
||||
return 42;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
});
|
||||
|
||||
is($dw->walk("t/"), 42);
|
||||
}
|
||||
Reference in New Issue
Block a user