From: gfx Date: Mon, 11 Jan 2010 06:43:51 +0000 (+0900) Subject: Merge extends.t and auto-subclass.t into subclass.t X-Git-Tag: 0.47~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=28e04346e8728a41dee8d7b2fce1cf00047c6459;p=gitmo%2FMouse.git Merge extends.t and auto-subclass.t into subclass.t --- diff --git a/t/001_mouse/005-extends.t b/t/001_mouse/002-subclass.t similarity index 55% rename from t/001_mouse/005-extends.t rename to t/001_mouse/002-subclass.t index 31d7d24..9dc7973 100644 --- a/t/001_mouse/005-extends.t +++ b/t/001_mouse/002-subclass.t @@ -1,20 +1,34 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 7; +use Test::More; use lib 't/lib'; +# auto-subclass do { package Class; use Mouse; +}; + +can_ok(Class => 'new'); + +my $object = Class->new; + +isa_ok($object => 'Class'); +isa_ok($object => 'Mouse::Object'); + +# extends() +do { + package ParentClass; + use Mouse; package Child; use Mouse; - extends 'Class'; + extends 'ParentClass'; package Mouse::TestClass; use Mouse; - extends 'Unsweetened'; + extends 'Unsweetened'; # in t/lib sub mouse { 1 } }; @@ -24,16 +38,17 @@ can_ok(Child => 'new'); my $child = Child->new; isa_ok($child => 'Child'); -isa_ok($child => 'Class'); +isa_ok($child => 'ParentClass'); isa_ok($child => 'Mouse::Object'); can_ok('Mouse::TestClass' => qw(mouse unsweetened)); -eval " +eval q{ package Child; use Mouse; -"; +}; -isa_ok($child => 'Class'); +isa_ok($child => 'ParentClass'); isa_ok($child => 'Mouse::Object'); +done_testing; diff --git a/t/001_mouse/004-auto-subclass.t b/t/001_mouse/004-auto-subclass.t deleted file mode 100644 index 2f4045b..0000000 --- a/t/001_mouse/004-auto-subclass.t +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 3; - -do { - package Class; - use Mouse; -}; - -can_ok(Class => 'new'); - -my $object = Class->new; - -isa_ok($object => 'Class'); -isa_ok($object => 'Mouse::Object'); -