CLI-Startup
view release on metacpan or search on metacpan
is_deeply $app->get_options->{x}, { a => 1, b => 2, c => '3=3' },
"Option was hashified";
is_deeply $app->get_raw_options, {}, "No command-line options";
}
# rcfile with a single hashy setting
{
open OUT, ">", $rcfile;
print OUT <<EOF;
x=a=1
EOF
close OUT;
my $app = CLI::Startup->new(
{ rcfile => $rcfile,
options => { 'x=s%' => 'x option' },
} );
$app->init;
is_deeply $app->get_options->{x}, { a => 1 },
"Single hashy option";
is_deeply $app->get_raw_options, {}, "No command-line options";
}
# rcfile with empty-valued hash setting
{
open OUT, ">", $rcfile;
print OUT <<EOF;
x=a=
y=a
EOF
close OUT;
my $app = CLI::Startup->new(
{ rcfile => $rcfile,
options => { 'x=s%' => 'x option', 'y=s%' => 'y option' },
} );
$app->init;
is_deeply $app->get_options->{x}, { a => '' },
"Blank-valued hashy option";
is_deeply $app->get_options->{y}, { a => '' },
"Blank-valued hashy option";
is_deeply $app->get_raw_options, {}, "No command-line options";
}
}
# Clean up
unlink $_ for glob("$dir/tmp/*");
rmdir "$dir/tmp";
done_testing();
sub file_info
{
my ($filename) = @_;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
return qq{
Inode\t$ino
Mode\t$mode
UID\t$uid
GID\t$gid
Size\t$size
Ctime\t$ctime
Mtime\t$mtime
Atime\t$atime
};
}
( run in 1.422 second using v1.01-cache-2.11-cpan-5a3173703d6 )