From: gfx Date: Fri, 9 Oct 2009 05:39:26 +0000 (+0900) Subject: Add 4 recipe tests X-Git-Tag: 0.37_05~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9aca0f35658e5e0657e8ce78b783c0185d59969;p=gitmo%2FMouse.git Add 4 recipe tests --- diff --git a/t/000_recipes/moose_cookbook_basics_recipe6.t b/t/000_recipes/moose_cookbook_basics_recipe6.t new file mode 100644 index 0000000..485abcf --- /dev/null +++ b/t/000_recipes/moose_cookbook_basics_recipe6.t @@ -0,0 +1,84 @@ +#!/usr/bin/perl -w + +use strict; +use Test::More 'no_plan'; +use Test::Exception; +$| = 1; + + + +# =begin testing SETUP +{ + + package Document::Page; + use Mouse; + + has 'body' => ( is => 'rw', isa => 'Str', default => sub {''} ); + + sub create { + my $self = shift; + $self->open_page; + inner(); + $self->close_page; + } + + sub append_body { + my ( $self, $appendage ) = @_; + $self->body( $self->body . $appendage ); + } + + sub open_page { (shift)->append_body('') } + sub close_page { (shift)->append_body('') } + + package Document::PageWithHeadersAndFooters; + use Mouse; + + extends 'Document::Page'; + + augment 'create' => sub { + my $self = shift; + $self->create_header; + inner(); + $self->create_footer; + }; + + sub create_header { (shift)->append_body('
') } + sub create_footer { (shift)->append_body('