MooseX-Getopt-Kingpin
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/01_basic.t view on Meta::CPAN
use Test::Exception;
use Getopt::Kingpin;
use_ok('MooseX::Getopt::Kingpin');
throws_ok {
MyTestClass->new_with_options();
} qr/First parameter ins't Getopt::Kingpin instance/, 'kingpin instance';
{
local @ARGV = ();
my $kingpin = Getopt::Kingpin->new();
exits_nonzero {
MyTestClass->new_with_options($kingpin);
} 'missing required options';
}
{
local @ARGV = ($0);
my $kingpin = Getopt::Kingpin->new();
my $my = MyTestClass->new_with_options($kingpin);
is($my->input_file, $0, 'required input_file');
is($my->lines, 10, 'default lines');
}
{
local @ARGV = ($0, '--lines', 100);
my $kingpin = Getopt::Kingpin->new();
my $my = MyTestClass->new_with_options($kingpin);
is($my->lines, 100, 'lines');
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.979 second using v1.00-cache-2.02-grep-82fe00e-cpan-c9a218a2bbc )