use warnings tester with fewer dependencies, issues
[gitmo/MooseX-Getopt.git] / t / 100_gld_default_bug.t
CommitLineData
630657d5 1use strict;
aec09248 2use warnings FATAL => 'all';
630657d5 3
9fbb5be9 4use Test::More tests => 6;
25eb430d 5use Test::Warnings;
630657d5 6
12f4bf75 7use Getopt::Long::Descriptive;
6a378fbd 8
9use_ok('MooseX::Getopt');
630657d5 10
11{
12 package Engine::Foo;
13 use Moose;
2557b526 14
630657d5 15 with 'MooseX::Getopt';
2557b526 16
630657d5 17 has 'nproc' => (
195fb408 18 traits => ['Getopt'],
630657d5 19 is => 'ro',
20 isa => 'Int',
21 default => sub { 1 },
22 cmd_aliases => 'n',
23 );
24}
25
26@ARGV = ();
27
28{
29 my $foo = Engine::Foo->new_with_options(nproc => 10);
30 isa_ok($foo, 'Engine::Foo');
31
32 is($foo->nproc, 10, '... got the right value (10), not the default (1)');
33}
34
35{
36 my $foo = Engine::Foo->new_with_options();
37 isa_ok($foo, 'Engine::Foo');
38
39 is($foo->nproc, 1, '... got the right value (1), without GLD needing to handle defaults');
40}
41
42
43