Docopt

 view release on metacpan or  search on metacpan

t/test_docopt.py.t  view on Meta::CPAN

    my $args = docopt(doc => "usage: prog [-ab] [options]\noptions: -x\n -y", argv => '-ax');
    # Need to use `is` (not `==`) since we want to make sure
    # that they are not 1/0, but strictly True/False:
    is_deeply($args->{'-a'}, True);
    is_deeply($args->{'-b'}, undef);
    is_deeply($args->{'-x'}, True);
    is_deeply($args->{'-y'}, undef);
};

subtest 'test_issue_65_evaluate_argv_when_called_not_when_imported' => sub {
    local @ARGV = qw(-a);
    is_deeply(docopt(doc => 'usage: prog [-ab]'), {'-a' => True, '-b' => undef});
    local @ARGV = qw(-b);
    is_deeply(docopt(doc => 'usage: prog [-ab]'), {'-a' => undef, '-b'=> True});
};


subtest 'test_issue_71_double_dash_is_not_a_valid_option_argument' => sub {
    isa_ok(
        exception { docopt(doc => 'usage: prog [--log=LEVEL] [--] <args>...', argv => '--log -- 1 2') },
        'Docopt::Exceptions::DocoptExit',
    );
    isa_ok(

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.035 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )