M: Code style (no tabs).

This commit is contained in:
Jens Luedicke
2013-03-10 19:37:50 +01:00
parent 395907e53b
commit 6ca6dad45b
3 changed files with 108 additions and 108 deletions

34
t/2.t
View File

@@ -10,25 +10,25 @@ ok(-e "t/");
ok(-d "t/"); ok(-d "t/");
foreach my $f qw(1.t 2.t 3.t 4.t) { foreach my $f qw(1.t 2.t 3.t 4.t) {
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->setDepth(1); $dw->setDepth(1);
$dw->onFile(sub { $dw->onFile(sub {
my ($path,$dir,$basename) = @_; my ($path,$dir,$basename) = @_;
ok(-e $path); ok(-e $path);
ok(-f $path); ok(-f $path);
ok(-d $dir); ok(-d $dir);
is($dir, "t"); is($dir, "t");
is($dw->currentDir(), "t"); is($dw->currentDir(), "t");
is($dw->currentDir(), $dir); is($dw->currentDir(), $dir);
is($dw->currentBasename(), $basename); is($dw->currentBasename(), $basename);
if (($dw->currentBasename() eq $f) and ($basename eq $f)) { if (($dw->currentBasename() eq $f) and ($basename eq $f)) {
return 42; return 42;
} }
return SUCCESS; return SUCCESS;
}); });
is($dw->walk("t/"), 42); is($dw->walk("t/"), 42);
} }

42
t/3.t
View File

@@ -11,45 +11,45 @@ my $perl_interpreter = basename($^X);
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onDirEnter(sub { $dw->onDirEnter(sub {
my ($path) = @_; my ($path) = @_;
ok(-e $path); ok(-e $path);
ok(-d $path); ok(-d $path);
if ($dw->currentPath() eq $perl_path) { if ($dw->currentPath() eq $perl_path) {
return 42; return 42;
} }
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk($perl_path), 42 ); is( $dw->walk($perl_path), 42 );
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onDirEnter(sub { $dw->onDirEnter(sub {
my ($path) = @_; my ($path) = @_;
ok(-e $path); ok(-e $path);
ok(-d $path); ok(-d $path);
if ($dw->currentDir() eq $perl_path) { if ($dw->currentDir() eq $perl_path) {
return 42; return 42;
} }
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk($perl_path), 42 ); is( $dw->walk($perl_path), 42 );
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onFile(sub { $dw->onFile(sub {
my ($path) = @_; my ($path) = @_;
ok(-e $path); ok(-e $path);
ok(-f $path); ok(-f $path);
if ($dw->currentBasename() eq $perl_interpreter) { if ($dw->currentBasename() eq $perl_interpreter) {
return 42; return 42;
} }
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk($perl_path), 42 ); is( $dw->walk($perl_path), 42 );

136
t/4.t
View File

@@ -13,91 +13,91 @@ ok( -e "t/tree" );
ok( -d "t/tree" ); ok( -d "t/tree" );
foreach my $subdir (qw(dir1 dir2 dir3 dir4 dir5)) { foreach my $subdir (qw(dir1 dir2 dir3 dir4 dir5)) {
ok( -e "t/tree/$subdir" ); ok( -e "t/tree/$subdir" );
ok( -d "t/tree/$subdir" ); ok( -d "t/tree/$subdir" );
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onBeginWalk(sub { $dw->onBeginWalk(sub {
my ($path,$dir,$basename) = @_; my ($path,$dir,$basename) = @_;
ok(-e $path); ok(-e $path);
is($dw->currentDir(), $dir); is($dw->currentDir(), $dir);
is($dw->currentBasename(), $basename); is($dw->currentBasename(), $basename);
if (($dw->currentBasename() eq $subdir) and ($basename eq $subdir)) { if (($dw->currentBasename() eq $subdir) and ($basename eq $subdir)) {
return 42; return 42;
} }
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk("t/tree"), 42 ); is( $dw->walk("t/tree"), 42 );
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onDirEnter(sub { $dw->onDirEnter(sub {
my ($path,$dir,$basename) = @_; my ($path,$dir,$basename) = @_;
ok(-e $path); ok(-e $path);
ok(-d $path); ok(-d $path);
ok(-d $dir); ok(-d $dir);
is($dw->currentDir(), $dir); is($dw->currentDir(), $dir);
is($dw->currentBasename(), $basename); is($dw->currentBasename(), $basename);
if (($dw->currentBasename() eq $subdir) and ($basename eq $subdir)) { if (($dw->currentBasename() eq $subdir) and ($basename eq $subdir)) {
is( $dw->count(), 10 ); is( $dw->count(), 10 );
is( $dw->currentDepth(), 2 ); is( $dw->currentDepth(), 2 );
return 42; return 42;
} }
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk("t/tree"), 42 ); is( $dw->walk("t/tree"), 42 );
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onDirLeave(sub { $dw->onDirLeave(sub {
my ($path,$dir,$basename) = @_; my ($path,$dir,$basename) = @_;
ok(-e $path); ok(-e $path);
ok(-d $path); ok(-d $path);
ok(-d $dir); ok(-d $dir);
is($dw->currentDir(), $dir); is($dw->currentDir(), $dir);
is($dw->currentBasename(), $basename); is($dw->currentBasename(), $basename);
if (($dw->currentBasename() eq $subdir) and ($basename eq $subdir)) { if (($dw->currentBasename() eq $subdir) and ($basename eq $subdir)) {
is( $dw->count(), 10 ); is( $dw->count(), 10 );
is( $dw->currentDepth(), 2 ); is( $dw->currentDepth(), 2 );
return 42; return 42;
} }
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk("t/tree"), 42 ); is( $dw->walk("t/tree"), 42 );
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onFile(sub { $dw->onFile(sub {
my ($path,$dir,$basename) = @_; my ($path,$dir,$basename) = @_;
ok(-e $path); ok(-e $path);
ok(-f $path); ok(-f $path);
ok(-d $dir); ok(-d $dir);
is($dir, "t/tree/$subdir"); is($dir, "t/tree/$subdir");
is($dw->currentDir(), "t/tree/$subdir"); is($dw->currentDir(), "t/tree/$subdir");
is($dw->currentDir(), $dir); is($dw->currentDir(), $dir);
is($dw->currentBasename(), $basename); is($dw->currentBasename(), $basename);
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk("t/tree/$subdir"), SUCCESS ); is( $dw->walk("t/tree/$subdir"), SUCCESS );
is( $dw->count(), 10 ); is( $dw->count(), 10 );
} }
$files = 0; $files = 0;
$dw = new File::DirWalk(); $dw = new File::DirWalk();
$dw->onFile(sub { $dw->onFile(sub {
my ($path,$dir,$basename) = @_; my ($path,$dir,$basename) = @_;
ok(-e $path); ok(-e $path);
ok(-f $path); ok(-f $path);
ok(-d $dir); ok(-d $dir);
is($dw->currentDir(), $dir); is($dw->currentDir(), $dir);
is($dw->currentBasename(), $basename); is($dw->currentBasename(), $basename);
++$files; ++$files;
return SUCCESS; return SUCCESS;
}); });
is( $dw->walk("t/tree"), SUCCESS ); is( $dw->walk("t/tree"), SUCCESS );