App-Memcached-CLI
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/main/parse_args.t view on Meta::CPAN
use App::Memcached::CLI::Util ':all';
my $Class = 'App::Memcached::CLI::Main';
subtest 'With address:port' => sub {
my @patterns = (
[qw/127.0.0.1:11211/],
[qw/www.google.com:443/],
);
for my $ptn (@patterns) {
local @ARGV = @$ptn;
my $parsed = $Class->parse_args;
is($parsed->{addr}, $ptn->[0], 'addr='.$ptn->[0]);
}
};
subtest 'With host' => sub {
my @patterns = (
[qw/192.168.0.1/],
[qw/www.google.com/],
);
for my $ptn (@patterns) {
local @ARGV = @$ptn;
my $parsed = $Class->parse_args;
is(
$parsed->{addr},
$ptn->[0].':'.DEFAULT_PORT(),
'addr='.$ptn->[0].':(default-port)',
);
}
};
subtest 'With addr by option' => sub {
my @patterns = (
[qw/-a 192.168.0.1/],
[qw/--addr www.google.com:1986/],
);
for my $ptn (@patterns) {
local @ARGV = @$ptn;
my $parsed = $Class->parse_args;
my $addr_to_be = create_addr($ptn->[1]);
is($parsed->{addr}, $addr_to_be, '--addr='.$addr_to_be);
}
};
done_testing;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.381 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )