File: 95any.t

package info (click to toggle)
libsub-handlesvia-perl 0.050000-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,840 kB
  • sloc: perl: 9,585; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 445 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;
use Test::More;
{ package Local::Dummy; use Test::Requires { 'Moo' => '1.006' } };

{
	package Local::Class;
	use Moo;
	use Sub::HandlesVia;
	has collection => (
		is          => 'ro',
		handles_via => 'Array',
		handles     => [qw/ any /],
	);
}

my $collection = Local::Class->new(
	collection => [qw/ 1 2 3 4 /],
);

ok(
	$collection->any(sub { $_==3 }),
);

ok(
	!$collection->any(sub { $_==5 }),
);

done_testing;