[Catalyst-commits] r12269 - in
Catalyst-Runtime/5.80/branches/script_roles: lib/Catalyst
t/aggregate
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Wed Dec 9 12:46:59 GMT 2009
Author: rafl
Date: 2009-12-09 12:46:59 +0000 (Wed, 09 Dec 2009)
New Revision: 12269
Modified:
Catalyst-Runtime/5.80/branches/script_roles/lib/Catalyst/ScriptRunner.pm
Catalyst-Runtime/5.80/branches/script_roles/t/aggregate/unit_core_scriptrunner.t
Log:
Fail hard if a script class exists but can't be loaded.
Modified: Catalyst-Runtime/5.80/branches/script_roles/lib/Catalyst/ScriptRunner.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/script_roles/lib/Catalyst/ScriptRunner.pm 2009-12-09 12:44:02 UTC (rev 12268)
+++ Catalyst-Runtime/5.80/branches/script_roles/lib/Catalyst/ScriptRunner.pm 2009-12-09 12:46:59 UTC (rev 12269)
@@ -14,8 +14,7 @@
Class::MOP::load_class($class);
}
catch {
- warn("Could not load $class - falling back to Catalyst::Script::$script : $_\n")
- if $_ !~ /Can't locate/;
+ confess $_ unless /Can't locate/;
$class = "Catalyst::Script::$script";
};
Modified: Catalyst-Runtime/5.80/branches/script_roles/t/aggregate/unit_core_scriptrunner.t
===================================================================
--- Catalyst-Runtime/5.80/branches/script_roles/t/aggregate/unit_core_scriptrunner.t 2009-12-09 12:44:02 UTC (rev 12268)
+++ Catalyst-Runtime/5.80/branches/script_roles/t/aggregate/unit_core_scriptrunner.t 2009-12-09 12:46:59 UTC (rev 12269)
@@ -2,6 +2,7 @@
use warnings;
use Test::More;
use FindBin qw/$Bin/;
+use Test::Exception;
use lib "$Bin/../lib";
use_ok('Catalyst::ScriptRunner');
@@ -13,12 +14,9 @@
is Catalyst::ScriptRunner->run('ScriptTestApp', 'Baz'), 'mooCatalyst::Script::Baz',
'Script existing only in Catalyst';
# +1 test for the params passed to new_with_options in t/lib/Catalyst/Script/Baz.pm
-{
- my $warnings = '';
- local $SIG{__WARN__} = sub { $warnings .= shift };
- is Catalyst::ScriptRunner->run('ScriptTestApp', 'CompileTest'), 'mooCatalyst::Script::CompileTest';
- like $warnings, qr/Does not compile/;
- like $warnings, qr/Could not load ScriptTestApp::Script::CompileTest - falling back to Catalyst::Script::CompileTest/;
-}
+throws_ok(sub {
+ Catalyst::ScriptRunner->run('ScriptTestApp', 'CompileTest');
+}, qr/Couldn't load class/);
+
done_testing;
More information about the Catalyst-commits
mailing list