X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funit_core_mvc.t;fp=t%2Funit_core_mvc.t;h=74b4ecf6a9e517c9c84aa7ec83ec7b1e18da364b;hb=fb5f42422b1ef1a4cc64ddfd83836c8c1d89bb2c;hp=dc080f9e258f29d620c594593f1095e23a0a5d51;hpb=dd8a0c31e0ba1056a350bcfadac07e5add83c6ad;p=catagits%2FCatalyst-Runtime.git diff --git a/t/unit_core_mvc.t b/t/unit_core_mvc.t index dc080f9..74b4ecf 100644 --- a/t/unit_core_mvc.t +++ b/t/unit_core_mvc.t @@ -1,4 +1,4 @@ -use Test::More tests => 37; +use Test::More tests => 40; use strict; use warnings; @@ -107,6 +107,20 @@ is ( MyApp->model , 'MyApp::Model::M', 'default_model in class method ok'); is_deeply( [ MyApp->view( qr{^V[ie]+w$} ) ], [ 'MyApp::V::View' ], 'regexp view ok' ); is_deeply( [ MyApp->controller( qr{Dummy\::Model$} ) ], [ 'MyApp::Controller::Model::Dummy::Model' ], 'regexp controller ok' ); is_deeply( [ MyApp->model( qr{Dum{2}y} ) ], [ 'MyApp::Model::Dummy::Model' ], 'regexp model ok' ); + + # ACCEPT_CONTEXT w/ qr{} + is_deeply( [ MyApp->model( qr{Test} ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' ); + + { + my $warnings = 0; + no warnings 'redefine'; + local *Catalyst::Log::warn = sub { $warnings++ }; + + # ACCEPT_CONTEXT w/ regexp fallback + is_deeply( [ MyApp->model( 'Test' ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' ); + ok( $warnings, 'regexp fallback warnings' ); + } + } {