From: Shawn M Moore Date: Thu, 2 Oct 2008 04:13:55 +0000 (+0000) Subject: t/010_basics/001_basic_class_setup.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34d9cc0ce8a95a404049348af2401adcdcb83579;p=gitmo%2FMoose.git t/010_basics/001_basic_class_setup.t --- diff --git a/t/010_basics/001_basic_class_setup.t b/t/010_basics/001_basic_class_setup.t index 0520394..778a7c3 100644 --- a/t/010_basics/001_basic_class_setup.t +++ b/t/010_basics/001_basic_class_setup.t @@ -1,44 +1,7 @@ -#!/usr/bin/perl - use strict; use warnings; - use Test::More tests => 22; -use Test::Exception; - - - -{ - package Foo; - use Moose; - use Moose::Util::TypeConstraints; -} - -can_ok('Foo', 'meta'); -isa_ok(Foo->meta, 'Moose::Meta::Class'); - -ok(Foo->meta->has_method('meta'), '... we got the &meta method'); -ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object'); - -dies_ok { - Foo->meta->has_method() -} '... has_method requires an arg'; - -dies_ok { - Foo->meta->has_method('') -} '... has_method requires an arg'; - -can_ok('Foo', 'does'); +use Moose::Test::Case; -foreach my $function (qw( - extends - has - before after around - blessed confess - type subtype as where - coerce from via - find_type_constraint - )) { - ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method'); -} +Moose::Test::Case->new->run_tests; diff --git a/t/010_basics/001_basic_class_setup/Foo.pm b/t/010_basics/001_basic_class_setup/Foo.pm new file mode 100644 index 0000000..106c95f --- /dev/null +++ b/t/010_basics/001_basic_class_setup/Foo.pm @@ -0,0 +1,6 @@ +package Foo; +use Moose; +use Moose::Util::TypeConstraints; + +1; + diff --git a/t/010_basics/001_basic_class_setup/foo.t b/t/010_basics/001_basic_class_setup/foo.t new file mode 100644 index 0000000..7043b89 --- /dev/null +++ b/t/010_basics/001_basic_class_setup/foo.t @@ -0,0 +1,33 @@ +use strict; +use warnings; + +use Test::Exception; + +can_ok('Foo', 'meta'); +isa_ok(Foo->meta, 'Moose::Meta::Class'); + +ok(Foo->meta->has_method('meta'), '... we got the &meta method'); +ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object'); + +dies_ok { + Foo->meta->has_method() +} '... has_method requires an arg'; + +dies_ok { + Foo->meta->has_method('') +} '... has_method requires an arg'; + +can_ok('Foo', 'does'); + +foreach my $function (qw( + extends + has + before after around + blessed confess + type subtype as where + coerce from via + find_type_constraint + )) { + ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method'); +} +