summaryrefslogtreecommitdiffstats
path: root/t/005-moose.t
blob: 59a01062be05dc109f1cf92648ea2b492f2d940e (plain) (blame)
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
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 6;

package Foo;
use Moose;

has foo => (
    is      => 'ro',
    default => 'FOO',
);

package Foo::Sub;
use Moose;
use MooseX::NonMoose;
extends 'Foo';

package main;
my $foo_sub = Foo::Sub->new;
isa_ok $foo_sub, 'Foo';
is $foo_sub->foo, 'FOO', 'inheritance works';
is(Foo::Sub->meta->get_method('new'), undef,
   'Foo::Sub doesn\'t have its own new method');

$_->meta->make_immutable for qw(Foo Foo::Sub);

$foo_sub = Foo::Sub->new;
isa_ok $foo_sub, 'Foo';
is $foo_sub->foo, 'FOO', 'inheritance works';
is(Foo::Sub->meta->get_method('new'), undef,
   'Foo::Sub doesn\'t have its own new method');