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