X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F050_metaclasses%2Ffailing%2F010_extending_and_embedding_back_compat.t;fp=t%2F050_metaclasses%2Ffailing%2F010_extending_and_embedding_back_compat.t;h=d1e05d532c8b070eea0d56ea2da9a05e8182bf52;hb=9864f0e4ba233c5f30ad6dc7c484ced43d883d27;hp=0000000000000000000000000000000000000000;hpb=8845df4dd6432e3164d078ade741409061adae9f;p=gitmo%2FMouse.git diff --git a/t/050_metaclasses/failing/010_extending_and_embedding_back_compat.t b/t/050_metaclasses/failing/010_extending_and_embedding_back_compat.t new file mode 100644 index 0000000..d1e05d5 --- /dev/null +++ b/t/050_metaclasses/failing/010_extending_and_embedding_back_compat.t @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 7; +use Test::Exception; + + + +BEGIN { + package MyFramework::Base; + use Mouse; + + package MyFramework::Meta::Base; + use Mouse; + + extends 'Mouse::Meta::Class'; + + package MyFramework; + use Mouse; + + sub import { + my $CALLER = caller(); + + strict->import; + warnings->import; + + return if $CALLER eq 'main'; + Mouse::init_meta( $CALLER, 'MyFramework::Base', 'MyFramework::Meta::Base' ); + Mouse->import({ into => $CALLER }); + + return 1; + } +} + +{ + package MyClass; + BEGIN { MyFramework->import } + + has 'foo' => (is => 'rw'); +} + +can_ok( 'MyClass', 'meta' ); + +isa_ok(MyClass->meta, 'MyFramework::Meta::Base'); +isa_ok(MyClass->meta, 'Mouse::Meta::Class'); + +my $obj = MyClass->new(foo => 10); +isa_ok($obj, 'MyClass'); +isa_ok($obj, 'MyFramework::Base'); +isa_ok($obj, 'Mouse::Object'); + +is($obj->foo, 10, '... got the right value'); + + + +