App-ReportPrereqs
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
xt/arguments.t view on Meta::CPAN
#!perl
use 5.006;
use strict;
use warnings;
use Capture::Tiny qw(capture);
use Test::More 0.88;
use lib qw(.);
require_ok('bin/report-prereqs') or BAIL_OUT();
note('invalid parameter');
{
local @ARGV = ('--no-such-option');
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('to many arguments');
{
local @ARGV = qw(hello world);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('--meta and --cpanfile');
{
local @ARGV = qw(--meta META.json --cpanfile cpanfile);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('--meta and url');
{
local @ARGV = qw(--meta META.json http://example.com);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('--cpanfile and url');
{
local @ARGV = qw(--cpanfile cpanfile http://example.com);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
#
done_testing();
exit 0;
# vim: ts=4 sts=4 sw=4 et: syntax=perl
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.381 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )