test role create hook
[gitmo/Role-Tiny.git] / t / create-hook.t
1 use strict;
2 use warnings FATAL => 'all';
3 use Test::More;
4
5 use Role::Tiny ();
6
7 my $last_role;
8 push @Role::Tiny::ON_ROLE_CREATE, sub {
9   ($last_role) = @_;
10 };
11
12 eval q{
13   package MyRole;
14   use Role::Tiny;
15 };
16
17 is $last_role, 'MyRole', 'role create hook was run';
18
19 eval q{
20   package MyRole2;
21   use Role::Tiny;
22 };
23
24 is $last_role, 'MyRole2', 'role create hook was run again';
25
26 done_testing;