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