* $ARGV[0] has slipped to $ARGV[1] in ::Test
-* ScriptRunner tests for MyApp::Script::DoesNotCompile
* Sort out help so that it shows what you fucked up.
* Fix horrible hacking around MX::Getopt's help display - probably by fixing MX::Getopt.
-* Tests for ::Create
lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib'));
+ warn("load $classtoload or Catalyst::Script::$scriptclass");
+
# FIXME - Error handling / reporting
- if ( eval { Class::MOP::load_class($classtoload) } ) {
- }
- else {
+ unless ( eval { Class::MOP::load_class($classtoload) } ) {
+ warn("Could not load $classtoload - falling back to Catalyst::Script::$scriptclass : $@\n")
+ if $@ !~ /Can't locate/;
$classtoload = "Catalyst::Script::$scriptclass";
Class::MOP::load_class($classtoload);
}
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
use FindBin qw/$Bin/;
use lib "$Bin/../lib";
is Catalyst::ScriptRunner->run('ScriptTestApp', 'Baz'), 'Catalyst::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::Script::CompileTest', Catalyst::ScriptRunner->run('ScriptTestApp', 'CompileTest');
+ like $warnings, qr/Does not compile/;
+ like $warnings, qr/Could not load ScriptTestApp::Script::CompileTest - falling back to Catalyst::Script::CompileTest/;
+}
+done_testing;