Debian Codegraph @

t/02behavior.t

raw symbols SCIP
1 use Test::More tests => 15;
2 use File::Monitor::Lite;
3 use File::Touch;
4 use File::Spec::Functions ':ALL';
5 use lib 'lib';
6
7 unlink glob '*.test';
8 my $m = File::Monitor::Lite->new( name => ['*.test'], in => '.',);
9
10 note 'create t.test';
11 touch 't.test';
12
13 ok $m->check, 'check done';
14 is_deeply [$m->created], [rel2abs('t.test')], 't.test created';
15 is_deeply [$m->deleted], [] , 'nothing deleted';
16 is_deeply [$m->modified], [] , 'nothing modified';
17 is_deeply [$m->observed], [rel2abs('t.test')], 'observing t.test';
18
19 note 'modify t.test';
20 open FILE, '>t.test';
21 print FILE 'testing...';
22 close FILE;
23 ok $m->check, 'check done';
24 is_deeply [$m->created], [], 'nothing created';
25 is_deeply [$m->deleted], [] , 'nothing deleted';
26 is_deeply [$m->modified], [rel2abs('t.test')] , 't.test modified';
27 is_deeply [$m->observed], [rel2abs('t.test')], 'observing t.test';
28
29 note 'delete t.test';
30 unlink glob '*.test';
31 ok $m->check, 'check done';
32 is_deeply [$m->created], [], 'nothing created';
33 is_deeply [$m->deleted], [rel2abs('t.test')] , 't.test deleted';
34 is_deeply [$m->modified], [] , 'nothing modified';
35 is_deeply [$m->observed], [], 'observing nothing';