X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Ffake_inotify.t;h=11dac117f0d14907eef1a3a21e0ae4a618fafadc;hb=933fce93167eba8645e637c363561575db9f9420;hp=f0db0cb58ec6459d41775ba53c5f5fbfee3a1a10;hpb=5808636263d72b635a46100a7e7037074dad8f75;p=public-inbox.git diff --git a/t/fake_inotify.t b/t/fake_inotify.t index f0db0cb5..11dac117 100644 --- a/t/fake_inotify.t +++ b/t/fake_inotify.t @@ -16,29 +16,25 @@ close $fh or BAIL_OUT "close: $!"; my $fi = PublicInbox::FakeInotify->new; my $mask = PublicInbox::FakeInotify::MOVED_TO_OR_CREATE(); -my $hit = []; -my $cb = sub { push @$hit, map { $_->fullname } @_ }; -my $w = $fi->watch("$tmpdir/new", $mask, $cb); +my $w = $fi->watch("$tmpdir/new", $mask); select undef, undef, undef, $MIN_FS_TICK; rename("$tmpdir/tst", "$tmpdir/new/tst") or BAIL_OUT "rename: $!"; -$fi->poll; -is_deeply($hit, ["$tmpdir/new/tst"], 'rename(2) detected'); +my @events = map { $_->fullname } $fi->read; +is_deeply(\@events, ["$tmpdir/new/tst"], 'rename(2) detected'); -@$hit = (); select undef, undef, undef, $MIN_FS_TICK; open $fh, '>', "$tmpdir/tst" or BAIL_OUT "open: $!"; close $fh or BAIL_OUT "close: $!"; link("$tmpdir/tst", "$tmpdir/new/link") or BAIL_OUT "link: $!"; -$fi->poll; -is_deeply($hit, ["$tmpdir/new/link"], 'link(2) detected'); +@events = map { $_->fullname } $fi->read; +is_deeply(\@events, ["$tmpdir/new/link"], 'link(2) detected'); $w->cancel; -@$hit = (); select undef, undef, undef, $MIN_FS_TICK; link("$tmpdir/new/tst", "$tmpdir/new/link2") or BAIL_OUT "link: $!"; -$fi->poll; -is_deeply($hit, [], 'link(2) not detected after cancel'); +@events = map { $_->fullname } $fi->read; +is_deeply(\@events, [], 'link(2) not detected after cancel'); PublicInbox::DS->Reset;