public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob c25c0f4251443295f749d40663bcf37aa1fc33ea 593 bytes (raw)
$ git show HEAD:t/inotify3.t	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 
#!perl -w
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use v5.12; use PublicInbox::TestCommon;
plan skip_all => 'inotify is Linux-only' if $^O ne 'linux';
use_ok 'PublicInbox::Inotify3';
my $in = PublicInbox::Inotify3->new;
my $tmpdir = tmpdir;
my $w = $in->watch("$tmpdir", PublicInbox::Inotify3::IN_ALL_EVENTS());
$in->blocking(0);
is_xdeeply [ $in->read ], [], 'non-blocking has no events, yet';
undef $tmpdir;
my @list = $in->read;
ok scalar(@list), 'got events';
ok $w->cancel, 'watch canceled';

done_testing;

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git