4 use Test::More tests => 8;
10 has gristle => (is => 'rw');
17 has tail => (is => 'rw');
19 __PACKAGE__->meta->make_immutable;
28 has yap => (is => 'rw');
30 # This class is mutable, but derives from an immutable base, and so
31 # used to inherit an immutable constructor compiled for the wrong
32 # class. It is composed with a Role, and should acquire both the
33 # attributes in that role, and the initialisers. Likewise for it's own
34 # attributes. (In the bug this test exhibited, it wasn't acquiring an
35 # initialiser for 'gristle' or 'yap').
37 # This has now been fixed by adding a check in the immutable
38 # constructor that the invoking class is the right one, else it
39 # redispatches to Mouse::Object::new.
45 my $fritz = SausageDog->new(gristle => 1,
50 isa_ok $fritz, 'SausageDog';
52 ok !$fritz->isa('Sausage'), "Fritz is not a Sausage";
53 ok $fritz->does('Sausage'), "Fritz does Sausage";
55 can_ok $fritz, qw(tail gristle yap);
57 ok $fritz->gristle, "Fritz has gristle";
58 ok $fritz->tail, "Fritz has a tail";
59 ok $fritz->yap, "Fritz has a yap";