Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: copied
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (34 sloc) 0.835 kb
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 5;
BEGIN {
use_ok('MouseX::Getopt');
}
{
package App;
use Mouse;
use Mouse::Util::TypeConstraints;
use Scalar::Util 'looks_like_number';
with 'MouseX::Getopt';
subtype 'ArrayOfInts'
=> as 'ArrayRef'
=> where { scalar (grep { looks_like_number($_) } @$_) };
has 'nums' => (
is => 'ro',
isa => 'ArrayOfInts',
default => sub { [0] }
);
}
{
local @ARGV = ();
my $app = App->new_with_options;
isa_ok($app, 'App');
is_deeply($app->nums, [0], '... nums is [0] as expected');
}
{
local @ARGV = ('--nums', 3, '--nums', 5);
my $app = App->new_with_options;
isa_ok($app, 'App');
is_deeply($app->nums, [3, 5], '... nums is [3, 5] as expected');
}
Jump to Line
Something went wrong with that request. Please try again.