+0.02_01 Fri Jun 11 18:12:26 PDT 2010
+ - modified verification of RunnableClass values to use
+ Params::Util::_CLASS (Karen Etheridge)
+
0.02 Mon Nov 2 02:30:10 CST 2009
- fix bug where roles of superclasses were not considered when
applying invocation schemes.
requires 'MooseX::Types::Path::Class';
requires 'namespace::autoclean';
requires 'List::MoreUtils';
+requires 'Params::Util';
build_requires 'Test::More';
build_requires 'ok';
use MooseX::Types -declare => ['RunnableClass'];
use MooseX::Types::Moose qw(Str HashRef ArrayRef);
use List::MoreUtils qw(uniq);
+use Params::Util qw(_CLASS);
use namespace::autoclean;
require Class::MOP;
subtype RunnableClass,
as Str,
- where { $_ =~ /^[:A-Za-z_]+$/ };
+ where { _CLASS($_) };
with 'MooseX::Runnable'; # this class technically follows
use strict;
use warnings;
use Test::Exception;
-use Test::More tests => 5;
+use Test::More tests => 9;
use MooseX::Runnable::Invocation;
use ok 'MooseX::Runnable::Invocation::Scheme::MooseX::Getopt';
}
}
-my $invocation = MooseX::Runnable::Invocation->new(
- class => 'Class',
-);
+{ package Class2;
+ use Moose;
+ extends 'Class';
+}
+
+foreach my $class (qw(Class Class2))
+{
+ my $invocation = MooseX::Runnable::Invocation->new(
+ class => $class,
+ );
-ok $invocation;
+ ok $invocation, 'class is instantiatable';
-my $code;
-lives_ok {
- $code = $invocation->run('--foo', '42', 0);
-} 'run lived';
+ my $code;
+ lives_ok {
+ $code = $invocation->run('--foo', '42', 0);
+ } 'run lived';
+
+ is $foo, '42', 'got foo from cmdline';
+
+ is $code, 0, 'exit status ok';
+}
-is $foo, '42', 'got foo from cmdline';
-is $code, 0, 'exit status ok';