Async-Selector

 view release on metacpan or  search on metacpan

t/18-watchers.t  view on Meta::CPAN

checkArray "'d', 'f'", [$s->watchers('d', 'f')], @w[3,5,7,10,12,15,16,17,18,19,20,21,22,23];
checkArray "'a', 'b', 'c', 'g'", [$s->watchers('a', 'b', 'c', 'g')],
    @w[0,1,2,6..23];
checkArray "'a', 'b', 'c', 'd', 'e'", [$s->watchers('a', 'b', 'c', 'd', 'e')], @w[0..4, 6..22];


note('--- watchers() should not obtain canceled watchers');
$w[$_]->cancel() foreach (5, 7, 8, 17, 21, 22, 23);
checkArray "'a'", [$s->watchers('a')], @w[0,6,13,18,20];
checkArray "'d', 'f'", [$s->watchers('d', 'f')], @w[3,10,12,15,16,18,19,20];
checkArray "all", [$s->watchers], @w[0..4,6,9..16,18..20,24];

note('--- watchers(undef) should be simply ignored.');
checkArray "empty resource name", [$s->watchers('')], $w[24];
checkArray 'undef', [$s->watchers(undef)], ();
checkArray "'g', undef", [$s->watchers('g', undef)], ();
checkArray "undef, undef, 'b'", [$s->watchers(undef, undef, 'b')], @w[1,6,9,10,11,13,14,15,18,19,20];

done_testing();




( run in 0.390 second using v1.01-cache-2.11-cpan-88abd93f124 )