App-Commando
view release on metacpan or search on metacpan
t/command.t view on Meta::CPAN
my $subcommand = App::Commando::Command->new('baz', $command);
$command->commands->{$subcommand->name} = $subcommand;
is $subcommand->full_name, 'foo baz', 'Full name of a subcommand is correct';
is $subcommand->identity, 'foo baz', 'Identity of a subcommand is correct';
is $command->default_command, undef, 'default_command is undefined as expected';
like exception { $command->default_command('bad'); },
qr/bad couldn't be found in this command's list of commands./,
'Exception is thrown when an unknown name is used with default_command';
is $command->default_command($subcommand->name), $subcommand,
'default_command returns the expected Command object';
done_testing;
use Test::Fatal;
use Test::More;
BEGIN { use_ok('App::Commando::Logger'); }
my $logger = App::Commando::Logger->new(*STDOUT);
isa_ok $logger, 'App::Commando::Logger', '$logger';
like exception { App::Commando::Logger->new(undef) },
qr/Can't open log device/, 'Exception is thrown for an invalid log device';
done_testing;
t/program.t view on Meta::CPAN
use Test::More;
BEGIN { use_ok('App::Commando::Program'); }
my $program = App::Commando::Program->new('foo');
isa_ok $program, 'App::Commando::Program', '$program';
is $program->name, 'foo', 'Program name is correct';
like exception { $program->go([ qw( --bad ) ]) },
qr/Unknown option: bad/, 'Exception is thrown for an unknown option';
done_testing;
( run in 0.353 second using v1.01-cache-2.11-cpan-496ff517765 )