summaryrefslogtreecommitdiff
path: root/t/exceptions/moose-meta-method-overridden.t
blob: a0831d6d352efd2088bfd0e9e86fdf373a748f7f (plain)
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 strict;
use warnings;

use Test::More;
use Test::Fatal;

{
    my $exception =  exception {
        package Foo;
        use Moose;

        override foo => sub {}
    };

    like(
        $exception,
        qr/You cannot override 'foo' because it has no super method/,
        "Foo class is not extending any class");

    isa_ok(
        $exception,
        "Moose::Exception::CannotOverrideNoSuperMethod",
        "Foo class is not extending any class");

    is(
        $exception->class,
        "Moose::Meta::Method::Overridden",
        "Foo class is not extending any class");

    is(
        $exception->method_name,
        "foo",
        "Foo class is not extending any class");
}

done_testing;