X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F050_metaclasses%2Ffailing%2F019_create_anon_with_required_attr.t;fp=t%2F050_metaclasses%2Ffailing%2F019_create_anon_with_required_attr.t;h=0000000000000000000000000000000000000000;hb=fde8e43f95fe996fbc2a778aa259feeb04552171;hp=3f4d2270632f2196595f3e402e0b880cbdbb096f;hpb=0bdc9d38dfd3de07aad929f6629f8fa65d434c27;p=gitmo%2FMouse.git diff --git a/t/050_metaclasses/failing/019_create_anon_with_required_attr.t b/t/050_metaclasses/failing/019_create_anon_with_required_attr.t deleted file mode 100644 index 3f4d227..0000000 --- a/t/050_metaclasses/failing/019_create_anon_with_required_attr.t +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/perl - -# this functionality may be pushing toward parametric roles/classes -# it's off in a corner and may not be that important - -use strict; -use warnings; - -use Test::More tests => 15; -use Test::Exception; - -{ - package HasFoo; - use Mouse::Role; - has 'foo' => ( - is => 'ro', - isa => 'Str', - required => 1, - ); - -} - -{ - package My::Metaclass; - use Mouse; - extends 'Mouse::Meta::Class'; - with 'HasFoo'; -} - -package main; - -my $anon; -lives_ok { - $anon = My::Metaclass->create_anon_class( foo => 'this' ); -} 'create anon class with required attr'; -isa_ok( $anon, 'My::Metaclass' ); -cmp_ok( $anon->foo, 'eq', 'this', 'foo is this' ); -dies_ok { - $anon = My::Metaclass->create_anon_class(); -} 'failed to create anon class without required attr'; - -my $meta; -lives_ok { - $meta - = My::Metaclass->initialize( 'Class::Name1' => ( foo => 'that' ) ); -} 'initialize a class with required attr'; -isa_ok( $meta, 'My::Metaclass' ); -cmp_ok( $meta->foo, 'eq', 'that', 'foo is that' ); -cmp_ok( $meta->name, 'eq', 'Class::Name1', 'for the correct class' ); -dies_ok { - $meta - = My::Metaclass->initialize( 'Class::Name2' ); -} 'failed to initialize a class without required attr'; - -lives_ok { - eval qq{ - package Class::Name3; - use metaclass 'My::Metaclass' => ( - foo => 'another', - ); - use Mouse; - }; - die $@ if $@; -} 'use metaclass with required attr'; -$meta = Class::Name3->meta; -isa_ok( $meta, 'My::Metaclass' ); -cmp_ok( $meta->foo, 'eq', 'another', 'foo is another' ); -cmp_ok( $meta->name, 'eq', 'Class::Name3', 'for the correct class' ); -dies_ok { - eval qq{ - package Class::Name4; - use metaclass 'My::Metaclass'; - use Mouse; - }; - die $@ if $@; -} 'failed to use metaclass without required attr'; - - -# how do we pass a required attribute to -traits? -dies_ok { - eval qq{ - package Class::Name5; - use Mouse -traits => 'HasFoo'; - }; - die $@ if $@; -} 'failed to use trait without required attr'; -