From: Dave Rolsky Date: Thu, 14 Aug 2008 13:59:48 +0000 (+0000) Subject: Add some tests for goto &Moose::import X-Git-Tag: 0_55_01~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e16d86b97dac20504e2cbfa56b74426b384ab4aa;p=gitmo%2FMoose.git Add some tests for goto &Moose::import --- diff --git a/MANIFEST b/MANIFEST index 85b6f9b..f412755 100644 --- a/MANIFEST +++ b/MANIFEST @@ -187,6 +187,7 @@ t/050_metaclasses/010_extending_and_embedding_back_compat.t t/050_metaclasses/011_init_meta.t t/050_metaclasses/012_moose_exporter.t t/050_metaclasses/013_metaclass_traits.t +t/050_metaclasses/014_goto_moose_import.t t/060_compat/001_module_refresh_compat.t t/060_compat/002_moose_respects_base.t t/060_compat/003_foreign_inheritence.t diff --git a/t/050_metaclasses/014_goto_moose_import.t b/t/050_metaclasses/014_goto_moose_import.t new file mode 100644 index 0000000..77f45ff --- /dev/null +++ b/t/050_metaclasses/014_goto_moose_import.t @@ -0,0 +1,59 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 2; +use Test::Exception; + +# Some packages out in the wild cooperate with Moose by using goto +# &Moose::import. we want to make sure it still works. + +{ + package MooseAlike1; + + use strict; + use warnings; + + use Moose (); + + sub import { + goto &Moose::import; + } +} + +{ + package Foo; + + MooseAlike1->import(); + + ::lives_ok( sub { has( 'size' ) }, + 'has was exported via MooseAlike1' ); +} + +{ + package MooseAlike2; + + use strict; + use warnings; + + use Moose (); + + my $import = \&Moose::import; + sub import { + goto $import; + } +} + +{ + package Bar; + + MooseAlike2->import(); + + ::lives_ok( sub { has( 'size' ) }, + 'has was exported via MooseAlike2' ); +} + + + +