From: Fuji, Goro Date: Sat, 25 Sep 2010 04:51:23 +0000 (+0900) Subject: Reorganize t/400_mouse_util X-Git-Tag: 0.72~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=43fb75d66ac7f19f2e8f9dc5baf798c62965b097;p=gitmo%2FMouse.git Reorganize t/400_mouse_util --- diff --git a/t/400_mouse_util/001_moose_util.t b/t/400_mouse_util/001_moose_util.t new file mode 100644 index 0000000..4083ca9 --- /dev/null +++ b/t/400_mouse_util/001_moose_util.t @@ -0,0 +1,15 @@ +#!/usr/bin/perl +# This is automatically generated by author/import-moose-test.pl. +# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! +use t::lib::MooseCompat; + +use strict; +use warnings; + +use Test::More; + +BEGIN { + use_ok('Mouse::Util'); +} + +done_testing; diff --git a/t/400_mouse_util/002_mouse_util_does_role.t b/t/400_mouse_util/002_moose_util_does_role.t similarity index 83% rename from t/400_mouse_util/002_mouse_util_does_role.t rename to t/400_mouse_util/002_moose_util_does_role.t index ac2c304..4851e6a 100644 --- a/t/400_mouse_util/002_mouse_util_does_role.t +++ b/t/400_mouse_util/002_moose_util_does_role.t @@ -1,9 +1,12 @@ #!/usr/bin/perl +# This is automatically generated by author/import-moose-test.pl. +# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! +use t::lib::MooseCompat; use strict; use warnings; -use Test::More tests => 8; +use Test::More; BEGIN { use_ok('Mouse::Util', ':all'); @@ -32,7 +35,7 @@ BEGIN { { package Quux; - #use metaclass; + use metaclass; } { @@ -79,3 +82,4 @@ ok(!does_role('Quux', 'Foo'), '... Quux doesnt do Foo (does not die tho)'); #ok(does_role('Foo::Foo', 'Foo'), '... Foo::Foo does do Foo'); +done_testing; diff --git a/t/400_mouse_util/007_apply_roles.t b/t/400_mouse_util/007_apply_roles.t new file mode 100644 index 0000000..a6b33b7 --- /dev/null +++ b/t/400_mouse_util/007_apply_roles.t @@ -0,0 +1,74 @@ +use strict; +# This is automatically generated by author/import-moose-test.pl. +# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! +use t::lib::MooseCompat; +use warnings; + +use Test::More; +use Mouse::Util qw( apply_all_roles ); + +{ + package Role::Foo; + use Mouse::Role; +} + +{ + package Role::Bar; + use Mouse::Role; +} + +{ + package Role::Baz; + use Mouse::Role; +} + +{ + package Class::A; + use Mouse; +} + +{ + package Class::B; + use Mouse; +} + +{ + package Class::C; + use Mouse; +} + +{ + package Class::D; + use Mouse; +} + +{ + package Class::E; + use Mouse; +} + +my @roles = qw( Role::Foo Role::Bar Role::Baz ); +apply_all_roles( 'Class::A', @roles ); +ok( Class::A->meta->does_role($_), "Class::A does $_" ) for @roles; + +apply_all_roles( 'Class::B', map { $_->meta } @roles ); +ok( Class::A->meta->does_role($_), + "Class::B does $_ (applied with meta role object)" ) + for @roles; + +@roles = qw( Role::Foo ); +apply_all_roles( 'Class::C', @roles ); +ok( Class::A->meta->does_role($_), "Class::C does $_" ) for @roles; + +apply_all_roles( 'Class::D', map { $_->meta } @roles ); +ok( Class::A->meta->does_role($_), + "Class::D does $_ (applied with meta role object)" ) + for @roles; + +@roles = qw( Role::Foo Role::Bar ), Role::Baz->meta; +apply_all_roles( 'Class::E', @roles ); +ok( Class::A->meta->does_role($_), + "Class::E does $_ (mix of names and meta role object)" ) + for @roles; + +done_testing;