File: make-role.t

package info (click to toggle)
librole-tiny-perl 2.002004-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 292 kB
  • sloc: perl: 454; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use strict;
use warnings;
use Test::More;

use Role::Tiny ();

Role::Tiny->make_role('Foo');
{
  no warnings 'once';
  *Foo::foo = sub {42};
}

ok( Role::Tiny->is_role('Foo'), 'Foo is_role');

for my $m (qw(requires with before around after)) {
  ok( !Foo->can($m), "Foo cannot '$m'" );
}

Role::Tiny->apply_roles_to_package('FooFoo', 'Foo');
can_ok 'FooFoo', 'foo';

done_testing;