X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FCookbook%2FExtending%2FRecipe3.pod;h=86aeec6a35c1b1b079fda9ecc0b41be3bc573ba2;hb=c79239a22fc3b30cac35dec0d704c7da52872aa5;hp=7db8b120d4cb372d8c8890fc45af01636bea6a6b;hpb=fc63d650f898bb025aa03d9b4aee10bb58beb081;p=gitmo%2FMoose.git diff --git a/lib/Moose/Cookbook/Extending/Recipe3.pod b/lib/Moose/Cookbook/Extending/Recipe3.pod index 7db8b12..86aeec6 100644 --- a/lib/Moose/Cookbook/Extending/Recipe3.pod +++ b/lib/Moose/Cookbook/Extending/Recipe3.pod @@ -1,6 +1,19 @@ =pod +=begin testing SETUP + +BEGIN { + eval 'use Test::Warn 0.11;'; + if ($@) { + diag 'Test::Warn 0.11+ is required for this test'; + ok(1); + exit 0; + } +} + +=end testing + =head1 NAME Moose::Cookbook::Extending::Recipe3 - Providing an alternate base object class @@ -24,7 +37,7 @@ Moose::Cookbook::Extending::Recipe3 - Providing an alternate base object class sub init_meta { shift; - Moose->init_meta( @_, base_class => 'MyApp::Object' ); + Moose->init_meta( @_, base_class => 'MyApp::Base' ); } =head1 DESCRIPTION @@ -87,4 +100,29 @@ L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. +=begin testing + +{ + package Foo; + + MyApp::UseMyBase->import; + + has( 'size' => ( is => 'rw' ) ); +} + +ok( Foo->isa('MyApp::Base'), 'Foo isa MyApp::Base' ); + +ok( Foo->can('size'), 'Foo has a size method' ); + +my $foo; +warning_is( + sub { $foo = Foo->new( size => 2 ) }, + 'Making a new Foo', + 'got expected warning when calling Foo->new' +); + +is( $foo->size(), 2, '$foo->size is 2' ); + +=end testing + =cut