File: around-does.t

package info (click to toggle)
librole-tiny-perl 2.000005-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 240 kB
  • ctags: 32
  • sloc: perl: 380; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 610 bytes parent folder | download | duplicates (2)
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
30
31
32
33
34
35
use strict;
use warnings;
use Test::More;

use Class::Method::Modifiers 1.05;

my $pass;
my $pass2;

BEGIN {
    package Local::Role;
    use Role::Tiny;
    around does => sub {
        my ($orig, $self, @args) = @_;
        $pass++;
        return $self->$orig(@args);
    };
    around DOES => sub {
        my ($orig, $self, @args) = @_;
        $pass2++;
        return $self->$orig(@args);
    };
}

BEGIN {
    package Local::Class;
    use Role::Tiny::With;
    with 'Local::Role';
}

ok(Local::Class->does('Local::Role'));
ok($pass);
ok(Local::Class->DOES('Local::Role'));
ok($pass2);
done_testing();