File: create-hook.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 (26 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (3)
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;
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;