From: Shawn M Moore Date: Tue, 28 Apr 2009 08:24:55 +0000 (-0400) Subject: More tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3d48cdcbac0a33442a0160247a3af6b7a69b85cf;p=gitmo%2FPerl-Critic-Dynamic-Moose.git More tests --- diff --git a/t/DynamicMoose/ProhibitPublicBuilders.run b/t/DynamicMoose/ProhibitPublicBuilders.run index dc83fe4..b4e27a5 100644 --- a/t/DynamicMoose/ProhibitPublicBuilders.run +++ b/t/DynamicMoose/ProhibitPublicBuilders.run @@ -66,3 +66,90 @@ __PACKAGE__->meta->add_attribute(attr => ( builder => $builder, )); +#----------------------------------------------------------------------------- + +## name Role sans builder +## failures 0 +## cut + +package Role; +use Moose::Role; + +has attr => ( + is => 'rw', +); + +#----------------------------------------------------------------------------- + +## name Role with private builder +## failures 0 +## cut + +package Role; +use Moose::Role; + +has attr => ( + is => 'rw', + builder => '_build_attr', +); + +#----------------------------------------------------------------------------- + +## name Role with public builder +## failures 1 +## cut + +package Role; +use Moose::Role; + +has attr => ( + is => 'rw', + builder => 'build_attr', +); + +#----------------------------------------------------------------------------- + +## name Public role builder method, named dynamically +## failures 1 +## cut + +package Role; +use Moose::Role; + +my $builder = 'build_' . rand; +__PACKAGE__->meta->add_attribute(attr => ( + is => 'rw', + builder => $builder, +)); + +#----------------------------------------------------------------------------- + +## name Lazy build +## failures 0 +## cut + +package Class; +use Moose; + +has foo => ( + is => 'rw', + lazy_build => 1, +); + +#----------------------------------------------------------------------------- + +## name The Gauntlet +## failures 0 +## cut + +for (1 .. 5) { + Class::MOP::Class->create_anon_class( + attributes => [ + Class::MOP::Attribute->new( + name => "foo_$_", + builder => "build_foo_$_", + ), + ], + ); +} +