mirror of
https://github.com/duncs/clusterssh.git
synced 2025-04-21 09:09:06 +00:00
Fix some tests failures
Fix failures picked up via cpantesters - Bump version - Remove accidental duplicate option in test file - Add TODO to test for duplicate options correctly - Fix test error when @ARGV is set to undef when this should never happen
This commit is contained in:
parent
457c3e8e1c
commit
fb4d991053
4 changed files with 35 additions and 4 deletions
1
Build.PL
1
Build.PL
|
@ -74,6 +74,7 @@ my $build = $class->new(
|
|||
'Locale::Maketext' => 0,
|
||||
'Exception::Class' => '1.31',
|
||||
'Try::Tiny' => 0,
|
||||
'Getopt::Long' => 0,
|
||||
},
|
||||
build_requires => {
|
||||
'Test::Pod::Coverage' => 0,
|
||||
|
|
3
Changes
3
Changes
|
@ -1,3 +1,6 @@
|
|||
4.04_05 ????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net>
|
||||
- Fix options parsing tests picked up via cpantesters on different version of perl
|
||||
|
||||
4.04_04 2014-12-12 Duncan Ferguson <duncan_ferguson@user.sf.net>
|
||||
- Do not use system perl but whatever is found in PATH (to stop breaking perlbrew based builds)
|
||||
- Warn when the configured terminal isn't installed/found
|
||||
|
|
|
@ -3,7 +3,7 @@ package App::ClusterSSH;
|
|||
use 5.008.004;
|
||||
use warnings;
|
||||
use strict;
|
||||
use version; our $VERSION = version->new('4.03_04');
|
||||
use version; our $VERSION = version->new('4.03_05');
|
||||
|
||||
use Carp qw/cluck/;
|
||||
|
||||
|
|
|
@ -133,12 +133,12 @@ is( $trap->stderr, '', 'Expecting no STDERR' );
|
|||
is( $trap->die, undef, 'Expecting no die message' );
|
||||
is( $getopts->option1, 1, 'Expecting no die message' );
|
||||
|
||||
local @ARGV = undef;
|
||||
local @ARGV = ''; # @ARGV is never undef, but an empty string
|
||||
$getopts = App::ClusterSSH::Getopt->new( parent => $mock_object );
|
||||
trap {
|
||||
$getopts->add_option( spec => 'option1', default => 5 );
|
||||
};
|
||||
is( $trap->leaveby, 'return', 'adding an empty option failed' );
|
||||
is( $trap->leaveby, 'return', 'adding an empty option with a default value' );
|
||||
is( $trap->die, undef, 'no error when spec provided' );
|
||||
is( $trap->stdout, '', 'Expecting no STDOUT' );
|
||||
is( $trap->stderr, '', 'Expecting no STDERR' );
|
||||
|
@ -289,7 +289,7 @@ $getopts->add_option(
|
|||
help => 'long opt help',
|
||||
default => 'default string'
|
||||
);
|
||||
$getopts->add_option( spec => 'another_long_opt|L=i', );
|
||||
$getopts->add_option( spec => 'another_long_opt|n=i', );
|
||||
$getopts->add_option( spec => 'a=s', help => 'short option only', );
|
||||
$getopts->add_option( spec => 'long', help => 'long option only', );
|
||||
trap {
|
||||
|
@ -393,4 +393,31 @@ is( $mock_object->{window_tiling}, 0, 'window_tiling set right' );
|
|||
is( $mock_object->{show_history}, 1, 'show_history set right' );
|
||||
is( $mock_object->{use_all_a_records}, 0, 'use_all_a_records set right' );
|
||||
|
||||
TODO: {
|
||||
local $TODO = "explitely test for duplicate options";
|
||||
$getopts = App::ClusterSSH::Getopt->new(
|
||||
parent => Test::ClusterSSH::Mock->new() );
|
||||
trap {
|
||||
$getopts->add_option( spec => 'option1' );
|
||||
};
|
||||
is( $trap->leaveby, 'return', 'adding an empty option failed' );
|
||||
is( $trap->die, undef, 'no error when spec provided' );
|
||||
is( $trap->stdout, '', 'Expecting no STDOUT' );
|
||||
is( $trap->stderr, '', 'Expecting no STDERR' );
|
||||
trap {
|
||||
$getopts->add_option( spec => 'option1' );
|
||||
};
|
||||
is( $trap->leaveby, 'die', 'adding an empty option failed' );
|
||||
is( $trap->die, "bling bling", 'no error when spec provided' );
|
||||
is( $trap->stdout, 'bling bling', 'Expecting no STDOUT' );
|
||||
is( $trap->stderr, 'bling bling', 'Expecting no STDERR' );
|
||||
trap {
|
||||
$getopts->getopts;
|
||||
};
|
||||
is( $trap->leaveby, 'return', 'getops on object with spec okay' );
|
||||
is( $trap->stdout, '', 'Expecting no STDOUT' );
|
||||
is( $trap->stderr, '', 'Expecting no STDERR' );
|
||||
is( $trap->die, undef, 'Expecting no die message' );
|
||||
}
|
||||
|
||||
done_testing;
|
||||
|
|
Loading…
Add table
Reference in a new issue