if configfile is a coderef call it and write some tests for it
[gitmo/MooseX-Getopt.git] / t / 101_argv_bug.t
CommitLineData
5bc5175c 1#!/usr/bin/env perl
f7655c45 2
3use strict;
4use warnings;
5
5bc5175c 6use Test::More tests => 3;
f7655c45 7
5bc5175c 8use MooseX::Getopt;
f7655c45 9
10{
11 package App;
12 use Moose;
f7655c45 13
5bc5175c 14 with 'MooseX::Getopt';
f7655c45 15
16 has 'length' => (
17 is => 'ro',
18 isa => 'Int',
5bc5175c 19 default => 24,
f7655c45 20 );
21
22 has 'verbose' => (
23 is => 'ro',
5bc5175c 24 isa => 'Bool',
25 default => 0,
f7655c45 26 );
5bc5175c 27 no Moose;
f7655c45 28}
29
30{
31 my $app = App->new_with_options(argv => [ '--verbose', '--length', 50 ]);
f7655c45 32 isa_ok($app, 'App');
33
f7655c45 34 ok($app->verbose, '... verbosity is turned on as expected');
5bc5175c 35 is($app->length, 50, '... length is 50 as expected');
f7655c45 36}
37