Skip to content

Commit

Permalink
Various fixes for handling deleted dirs.
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed May 14, 2009
1 parent db2d796 commit 52b93b0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/File/ChangeNotify/Watcher/Inotify.pm
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ sub _interesting_events
push @interesting, $event;
push @interesting, $self->_fake_events_for_new_dir( $event->fullname() );
}
elsif ( $event->IN_DELETE_SELF()
# We just want to check the _file_ name
|| $event->name() =~ /$filter/ )
elsif ( $event->IN_DELETE_SELF() )
{
$self->_remove_directory( $event->fullname() )
if $event->IN_DELETE_SELF();

}
# We just want to check the _file_ name
elsif( $event->name() =~ /$filter/ )
{
push @interesting, $event;
}
}
Expand Down
20 changes: 18 additions & 2 deletions t/lib/File/ChangeNotify/TestHelper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sub run_tests
{
my @classes = File::ChangeNotify->usable_classes();

plan tests => 27 * @classes;
plan tests => 31 * @classes;

for my $class (@classes)
{
Expand Down Expand Up @@ -213,7 +213,7 @@ sub _dir_add_remove_tests
my $subdir2 = "$dir/subdir2";

mkpath( $subdir1, 0, 0755 );
rmtree( $subdir1 );
rmtree($subdir1);

mkpath( $subdir2, 0, 0755 );

Expand Down Expand Up @@ -256,6 +256,22 @@ sub _dir_add_remove_tests
"created/delete $subdir1 and created one file ($path) in a new subdir ($subdir2)",
);
}

rmtree($subdir2);

_check_events
( 2,
# The Default & Inotify watchers have different orders for these events
[ sort { $a->path() cmp $b->path() } $events_sub->($watcher) ],
[ { path => $subdir2,
type => 'delete',
},
{ path => $path,
type => 'delete',
},
],
"deleted $subdir2",
);
}

sub _symlink_tests
Expand Down

0 comments on commit 52b93b0

Please sign in to comment.