[Catalyst-commits] r11162 - in trunk/misc: . custom_exception_work custom_exception_work/t custom_exception_work/t/lib

ferz at dev.catalyst.perl.org ferz at dev.catalyst.perl.org
Wed Aug 19 07:10:48 GMT 2009


Author: ferz
Date: 2009-08-19 07:10:48 +0000 (Wed, 19 Aug 2009)
New Revision: 11162

Added:
   trunk/misc/custom_exception_work/
   trunk/misc/custom_exception_work/t/
   trunk/misc/custom_exception_work/t/custom_exception_work.t
   trunk/misc/custom_exception_work/t/lib/
   trunk/misc/custom_exception_work/t/lib/TestAppCustomExceptionWork.pm
Log:
New test for custom_exception.


Added: trunk/misc/custom_exception_work/t/custom_exception_work.t
===================================================================
--- trunk/misc/custom_exception_work/t/custom_exception_work.t	                        (rev 0)
+++ trunk/misc/custom_exception_work/t/custom_exception_work.t	2009-08-19 07:10:48 UTC (rev 11162)
@@ -0,0 +1,24 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
+use Test::More tests => 5;
+use Test::Exception;
+
+lives_ok {
+    require TestAppCustomExceptionWork;
+} 'Can load application';
+
+
+use Catalyst::Test 'TestAppCustomExceptionWork';
+
+can_ok( 'TestAppCustomExceptionWork::Exception' , 'throw');
+can_ok( $Catalyst::Exception::EXCEPTION_CLASS , 'throw');
+
+throws_ok { TestAppCustomExceptionWork::Exception->throw('test') } qr/Exception class TestAppCustomExceptionWork::Exception does not contain a 'throw' method/;
+throws_ok { $Catalyst::Exception::EXCEPTION_CLASS->throw('test') } qr/Catalyst Custom Exception class does not contain a 'throw' method/;
+
+1;
+

Added: trunk/misc/custom_exception_work/t/lib/TestAppCustomExceptionWork.pm
===================================================================
--- trunk/misc/custom_exception_work/t/lib/TestAppCustomExceptionWork.pm	                        (rev 0)
+++ trunk/misc/custom_exception_work/t/lib/TestAppCustomExceptionWork.pm	2009-08-19 07:10:48 UTC (rev 11162)
@@ -0,0 +1,35 @@
+package TestAppCustomExceptionWork::Exceptions;
+
+use strict;
+use warnings;
+
+BEGIN {
+    $Catalyst::Exception::CATALYST_EXCEPTION_CLASS = 'TestAppCustomExceptionWork::Exception';
+}
+
+package TestAppCustomExceptionWork::Exception;
+
+use strict;
+use warnings;
+no warnings 'redefine';
+
+sub throw { die bless({}, __PACKAGE__) }
+
+#########
+
+package TestAppCustomExceptionWork;
+
+use strict;
+use warnings;
+use Scalar::Util ();
+use Catalyst::Runtime '5.80';
+
+use Catalyst qw/ -Debug /;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config( name => 'TestAppCustomExceptionWork' );
+
+__PACKAGE__->setup;
+
+1;




More information about the Catalyst-commits mailing list