File: create-hook.t

package info (click to toggle)
librole-tiny-perl 1.003004-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 236 kB
  • ctags: 43
  • sloc: perl: 400; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 384 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
23
24
25
26
use strict;
use warnings FATAL => 'all';
use Test::More;

use Role::Tiny ();

my $last_role;
push @Role::Tiny::ON_ROLE_CREATE, sub {
  ($last_role) = @_;
};

eval q{
  package MyRole;
  use Role::Tiny;
};

is $last_role, 'MyRole', 'role create hook was run';

eval q{
  package MyRole2;
  use Role::Tiny;
};

is $last_role, 'MyRole2', 'role create hook was run again';

done_testing;