[Catalyst-commits] r7869 - Catalyst-Runtime/5.70/branches/compres/t
bricas at dev.catalyst.perl.org
bricas at dev.catalyst.perl.org
Fri May 30 13:57:48 BST 2008
Author: bricas
Date: 2008-05-30 13:57:48 +0100 (Fri, 30 May 2008)
New Revision: 7869
Modified:
Catalyst-Runtime/5.70/branches/compres/t/unit_core_component.t
Log:
add a test for warnings from comp()
Modified: Catalyst-Runtime/5.70/branches/compres/t/unit_core_component.t
===================================================================
--- Catalyst-Runtime/5.70/branches/compres/t/unit_core_component.t 2008-05-30 12:54:43 UTC (rev 7868)
+++ Catalyst-Runtime/5.70/branches/compres/t/unit_core_component.t 2008-05-30 12:57:48 UTC (rev 7869)
@@ -1,4 +1,4 @@
-use Test::More tests => 10;
+use Test::More tests => 11;
use strict;
use warnings;
@@ -12,6 +12,9 @@
use base qw/Catalyst/;
__PACKAGE__->components({ map { ($_, $_) } @complist });
+
+ # this is so $c->log->warn will work
+ __PACKAGE__->setup_log;
}
is(MyApp->comp('MyApp::V::View'), 'MyApp::V::View', 'Explicit return ok');
@@ -21,8 +24,15 @@
is(MyApp->comp('Model'), 'MyApp::M::Model', 'Single part return ok');
# regexp fallback
-is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok');
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+ is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok');
+ ok( $warnings, 'regexp fallback for comp() warns' );
+}
+
is_deeply([ MyApp->comp() ], \@complist, 'Empty return ok');
# Is this desired behaviour?
More information about the Catalyst-commits
mailing list