From: Dave Rolsky Date: Mon, 4 Jan 2010 16:31:25 +0000 (-0600) Subject: Fix extending recipe 2 to actually work, and add tests X-Git-Tag: 0.93_01~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e646af942661c0c4ec6bc2c7e6ceeebe538625a;p=gitmo%2FMoose.git Fix extending recipe 2 to actually work, and add tests --- diff --git a/lib/Moose/Cookbook/Extending/Recipe2.pod b/lib/Moose/Cookbook/Extending/Recipe2.pod index ce05b9f..8fff44c 100644 --- a/lib/Moose/Cookbook/Extending/Recipe2.pod +++ b/lib/Moose/Cookbook/Extending/Recipe2.pod @@ -1,6 +1,19 @@ =pod +=begin testing-SETUP + +BEGIN { + eval 'use Test::Output;'; + if ($@) { + diag 'Test::Output is required for this test'; + ok(1); + exit 0; + } +} + +=end testing-SETUP + =head1 NAME Moose::Cookbook::Extending::Recipe2 - Providing a role for the base object class @@ -19,10 +32,10 @@ Moose::Cookbook::Extending::Recipe2 - Providing a role for the base object class use Moose::Role; - after 'BUILD' => sub { + after 'BUILDALL' => sub { my $self = shift; - warn "Made a new " . ref $self . " object\n"; + warn "Made a new " . ( ref $self ) . " object\n"; }; =head1 DESCRIPTION @@ -66,5 +79,21 @@ L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=cut +=begin testing + +{ + package Debugged; + use Moose; + MooseX::Debugging->import; +} + +stderr_is( + sub { Debugged->new }, + "Made a new Debugged object\n", + 'got expected output from debugging role' +); + +=end testing + +=cut