From: Shawn M Moore Date: Thu, 11 Sep 2008 06:39:57 +0000 (+0000) Subject: Add a failing test for the following construct, which explodes due to metaclass incom... X-Git-Tag: 0.58~42 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3c822aeb4a98cd3b84507aa0618926acc5918d41;p=gitmo%2FMoose.git Add a failing test for the following construct, which explodes due to metaclass incompatibility: package Parent; use Moose -traits => ...; package Child; use base 'Parent'; --- diff --git a/t/050_metaclasses/017_traits_plain_subclass.t b/t/050_metaclasses/017_traits_plain_subclass.t new file mode 100644 index 0000000..8687e7d --- /dev/null +++ b/t/050_metaclasses/017_traits_plain_subclass.t @@ -0,0 +1,38 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use Test::More tests => 4; +use Test::Exception; + +{ + package NoOpTrait; + use Moose::Role; +} + +{ + package Parent; + use Moose -traits => 'NoOpTrait'; + + has attr => ( + is => 'rw', + isa => 'Str', + ); +} + +{ + package Child; + use base 'Parent'; +} + +is(Child->meta->name, 'Child', "correct metaclass name"); + +my $child = Child->new(attr => "ibute"); +ok($child, "constructor works"); + +is($child->attr, "ibute", "getter inherited properly"); + +$child->attr("ition"); +is($child->attr, "ition", "setter inherited properly"); +