Removed optional_value, made --version-check have default: off, updated the tools and documentation with the changes, and added the auto value to Pingback.pm

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-10-30 12:42:42 -03:00
parent d616a7e5e6
commit 6e3d3e6c96
30 changed files with 568 additions and 498 deletions

View File

@@ -145,7 +145,6 @@ is_deeply(
type => 's',
got => 0,
value => undef,
optional_value => 0,
},
'port' => {
spec => 'port|p=i',
@@ -159,7 +158,6 @@ is_deeply(
type => 'i',
got => 0,
value => undef,
optional_value => 0,
},
'price' => {
spec => 'price=f',
@@ -173,7 +171,6 @@ is_deeply(
type => 'f',
got => 0,
value => undef,
optional_value => 0,
},
'hash-req' => {
spec => 'hash-req=s',
@@ -187,7 +184,6 @@ is_deeply(
type => 'H',
got => 0,
value => undef,
optional_value => 0,
},
'hash-opt' => {
spec => 'hash-opt=s',
@@ -201,7 +197,6 @@ is_deeply(
type => 'h',
got => 0,
value => undef,
optional_value => 0,
},
'array-req' => {
spec => 'array-req=s',
@@ -215,7 +210,6 @@ is_deeply(
type => 'A',
got => 0,
value => undef,
optional_value => 0,
},
'array-opt' => {
spec => 'array-opt=s',
@@ -229,7 +223,6 @@ is_deeply(
type => 'a',
got => 0,
value => undef,
optional_value => 0,
},
'host' => {
spec => 'host=s',
@@ -243,7 +236,6 @@ is_deeply(
type => 'd',
got => 0,
value => undef,
optional_value => 0,
},
'chunk-size' => {
spec => 'chunk-size=s',
@@ -257,7 +249,6 @@ is_deeply(
type => 'z',
got => 0,
value => undef,
optional_value => 0,
},
'time' => {
spec => 'time=s',
@@ -271,7 +262,6 @@ is_deeply(
type => 'm',
got => 0,
value => undef,
optional_value => 0,
},
'help' => {
spec => 'help+',
@@ -285,7 +275,6 @@ is_deeply(
type => undef,
got => 0,
value => undef,
optional_value => 0,
},
'other' => {
spec => 'other!',
@@ -299,7 +288,6 @@ is_deeply(
type => undef,
got => 0,
value => undef,
optional_value => 0,
}
},
'Parse opt specs'
@@ -520,7 +508,6 @@ is_deeply(
type => undef,
got => 0,
value => undef,
optional_value => 0,
},
'defaultset' => {
spec => 'defaultset!',
@@ -536,7 +523,6 @@ is_deeply(
type => undef,
got => 0,
value => undef,
optional_value => 0,
},
'defaults-file' => {
spec => 'defaults-file|F=s',
@@ -550,7 +536,6 @@ is_deeply(
type => 's',
got => 0,
value => undef,
optional_value => 0,
},
'dog' => {
spec => 'dog|D=s',
@@ -564,7 +549,6 @@ is_deeply(
type => 's',
got => 0,
value => undef,
optional_value => 0,
},
'love' => {
spec => 'love|l+',
@@ -578,7 +562,6 @@ is_deeply(
type => undef,
got => 0,
value => undef,
optional_value => 0,
},
},
'Parse dog specs'
@@ -978,7 +961,6 @@ is_deeply(
long => 'bar',
type => undef,
parsed => 1,
optional_value=> 0,
},
'Disabled opt is not destroyed'
);
@@ -2008,55 +1990,13 @@ $o->get_opts();
$output = output(
sub { $o->usage_or_errors(undef, 1); },
);
$synop{usage} =~ s/([\[\]])/\\$1/g;
like(
$output,
qr/^$synop{description} For more details.+\nUsage: \Q$synop{usage}\E\n?$/m,
qr/^$synop{description} For more details.+\nUsage: $synop{usage}$/m,
"Uses desc and usage from SYNOPSIS for help"
);
# Add a value_is_optional option
@ARGV = qw();
$o->get_opts();
ok(
!$o->got('version-check'),
"version-check is not true by default"
);
is(
$o->get('version-check'),
"https",
"..but it still has a value",
);
@ARGV = qw(--version-check);
$o->get_opts();
ok(
$o->got('version-check'),
"version-check is true if specified without arguments"
);
is(
$o->get('version-check'),
"https",
"..and has the default value",
);
@ARGV = qw(--version-check http);
$o->get_opts();
ok(
$o->got('version-check'),
"version-check is true if specified with arguments"
);
is(
$o->get('version-check'),
"http",
"..and has the specified value",
);
# #############################################################################
# Bug 1039074: Tools exit 0 on error parsing options, should exit non-zero
# #############################################################################
@@ -2094,3 +2034,4 @@ like(
);
done_testing;
exit;