mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 09:53:23 +00:00
Improve test coverage
This commit is contained in:
parent
c807b52129
commit
f27c42c795
2 changed files with 23 additions and 2 deletions
|
@ -261,7 +261,7 @@ sub resolve_names(@) {
|
||||||
|
|
||||||
if ( $self->config->{unique_servers} ) {
|
if ( $self->config->{unique_servers} ) {
|
||||||
$self->debug( 3, 'removing duplicate server names' );
|
$self->debug( 3, 'removing duplicate server names' );
|
||||||
@servers = remove_repeated_servers(@servers);
|
@servers = $self->remove_repeated_servers(@servers);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->debug( 3, 'leaving with ', $_ ) foreach (@servers);
|
$self->debug( 3, 'leaving with ', $_ ) foreach (@servers);
|
||||||
|
@ -270,7 +270,8 @@ sub resolve_names(@) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub remove_repeated_servers {
|
sub remove_repeated_servers {
|
||||||
my %all = ();
|
my $self = shift;
|
||||||
|
my %all = ();
|
||||||
@all{@_} = 1;
|
@all{@_} = 1;
|
||||||
return ( keys %all );
|
return ( keys %all );
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,4 +29,24 @@ $app = App::ClusterSSH->new();
|
||||||
isa_ok( $app, 'App::ClusterSSH' );
|
isa_ok( $app, 'App::ClusterSSH' );
|
||||||
isa_ok( $app->config, 'App::ClusterSSH::Config' );
|
isa_ok( $app->config, 'App::ClusterSSH::Config' );
|
||||||
|
|
||||||
|
for my $submod (qw/ cluster helper options window /) {
|
||||||
|
trap {
|
||||||
|
$app->$submod;
|
||||||
|
};
|
||||||
|
$trap->quiet("$submod loaded okay");
|
||||||
|
}
|
||||||
|
|
||||||
|
trap {
|
||||||
|
$app->exit_prog;
|
||||||
|
};
|
||||||
|
$trap->quiet("No errors from exit_prog call");
|
||||||
|
|
||||||
|
my @provided = (qw/ one one one two two three four four four /);
|
||||||
|
my @expected = sort (qw/ one two three four /);
|
||||||
|
my @got;
|
||||||
|
trap {
|
||||||
|
@got = sort $app->remove_repeated_servers(@provided);
|
||||||
|
};
|
||||||
|
is_deeply( \@got, \@expected, "Repeated servers removed okay" );
|
||||||
|
|
||||||
done_testing();
|
done_testing();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue