File: 01_inotify.t

package info (click to toggle)
liblinux-inotify2-perl 1%3A1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 140 kB
  • ctags: 19
  • sloc: perl: 126; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use Test::Simple tests => 5;
use Linux::Inotify2;

my $in = Linux::Inotify2->new;
ok ($in, "inotify handle created");

# create directory for watch
mkdir $$;

my $watch = $in->watch ($$, IN_ALL_EVENTS);
ok ($watch, "watch created for directory $$");

$in->blocking (0);

{
  my @list = $in->read;
  ok (@list==0, "non blocking: $!");
}

rmdir $$;

{
  my @list = $in->poll;
  ok (@list > 0, scalar @list . " events read");
}

ok ($watch->cancel, "watch canceled");

END {
  rmdir $$;
}