File: 069-add-modifier.t

package info (click to toggle)
libmouse-perl 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,156 kB
  • sloc: perl: 14,569; ansic: 218; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 416 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!perl
use strict;
use warnings;
use lib 't/lib';

use Test::More;
use Test::Exception;

throws_ok {
    A->meta->add_around_method_modifier(bar => sub { "baz" });
} qr/The method 'bar' was not found in the inheritance hierarchy for A/;

{
    package A;
    use Mouse;

    sub foo { "foo" };
}

A->meta->add_around_method_modifier(foo => sub { "bar" });

is(A->foo(), 'bar', 'add_around_modifier');

done_testing;