App-DocKnot
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/cli/errors.t view on Meta::CPAN
# Create the command-line parser.
my $docknot = App::DocKnot::Command->new();
isa_ok($docknot, 'App::DocKnot::Command');
# Test various errors.
eval { $docknot->run('foo') };
is_error($@, 'unknown command foo', 'Unknown command');
eval { $docknot->run('--bogus', 'generate') };
is_error($@, 'unknown option: bogus', 'Unknown top-level option');
local @ARGV = ();
eval { $docknot->run() };
is_error($@, 'no subcommand given', 'No subcommand');
eval { $docknot->run('generate', '-f', 'readme') };
is_error($@, 'generate: unknown option: f', 'Unknown option');
eval { $docknot->run('generate') };
is_error($@, 'generate: too few arguments', 'Too few arguments');
eval { $docknot->run('generate', 'a', 'b', 'c') };
is_error($@, 'generate: too many arguments', 'Too many arguments');
# Check that commands with no arguments are handled correctly.
t/cli/generate.t view on Meta::CPAN
{
my $tempfile = Path::Tiny->tempfile();
$docknot->run('generate', 'readme', "$tempfile");
my $output = $tempfile->slurp_utf8();
is_file_contents($output, 'README', 'Generated README from argument list');
}
# Do the same thing again, but using arguments from @ARGV.
{
my $tempfile = Path::Tiny->tempfile();
local @ARGV = ('generate', 'readme-md', "$tempfile");
$docknot->run();
my $output = $tempfile->slurp_utf8();
is_file_contents($output, 'README.md', 'Generated README.md from ARGV');
}
# Save the paths to various files in the source directory.
my $readme_path = path('README')->realpath();
my $readme_md_path = path('README.md')->realpath();
my $metadata_path = path('docs', 'docknot.yaml')->realpath();
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.520 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )