4 use Test::More tests => 8;
6 use ok 'MooseX::Runnable';
7 use ok 'MooseX::Runnable::Invocation';
11 with 'MooseX::Runnable';
14 my ($self, @args) = @_;
16 $result += $_ for @args;
21 my $invocation = MooseX::Runnable::Invocation->new(
29 $code = $invocation->run(1,2,3);
32 is $code, 6, 'run worked';
34 { package MooseX::Runnable::Invocation::Plugin::ExitFixer;
38 my ($next, $self, @args) = @_;
39 my $code = $self->$next(@args);
41 else { confess "Exited with error." }
45 $invocation = MooseX::Runnable::Invocation->new(
47 plugins => ['+MooseX::Runnable::Invocation::Plugin::ExitFixer'],
53 $code = $invocation->run(1,2,3);
56 is $code, 0, 'run worked, and plugin changed the return code';