File: mxd-replace.t

package info (click to toggle)
libmethod-signatures-perl 20170211-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 672 kB
  • sloc: perl: 3,860; makefile: 2
file content (36 lines) | stat: -r--r--r-- 999 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
25
26
27
28
29
30
31
32
33
34
35
36

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

use lib 't/lib';
use GenErrorRegex qw< badval_error badtype_error >;


# First test: try the method where you load MXD, then load MSM, which inserts itself into MXD
# and replaces MXMS.


SKIP:
{
    eval { require MooseX::Declare } or skip "MooseX::Declare required for this test", 1;

    # have to require here or else we try to load MXD before we check for it not being there (above)
    require MS_MXD_Replace or die("can't load test module: $@");
    MS_MXD_Replace->import;

    my $foo = Foo->new;
    my $foobar = Foo::Bar->new;

    foreach ( qw< before after around override augment > )
    {
        my $method = "test_$_";
        throws_ok { $foo->$method('bmoogle') } badval_error($foo, num => Num => 'bmoogle' => $method),
                "MXD using MS for method ($_)";
        throws_ok { $foobar->$method(.5) } badval_error($foobar, num => Int => .5 => $method),
                "MXD using MSM for modifier ($_)";
    }

}


done_testing();