5e7bc2e574408ffeaabd55f484d4bdf8d22c30f1
[gitmo/MooseX-ConfigFromFile.git] / t / 04b_getopt.t
1 use strict;
2 use warnings FATAL => 'all';
3
4 use Test::Requires 'MooseX::Getopt';    # skip all if not installed
5 use Test::More tests => 3;
6 use Test::NoWarnings 1.04 ':early';
7
8 {
9     package Foo::Options;
10
11     use Moose;
12     with qw(MooseX::Getopt MooseX::ConfigFromFile);
13     sub get_config_from_file { }
14 }
15
16 {
17     package Foo::NoOptions;
18
19     use Moose;
20     with qw(MooseX::ConfigFromFile);
21     sub get_config_from_file { }
22 }
23
24 ok(
25     Foo::Options->meta->find_attribute_by_name('configfile')->does('MooseX::Getopt::Meta::Attribute::Trait'),
26     'classes with MooseX::Getopt have the Getopt attr trait added',
27 );
28
29 ok(
30     Foo::NoOptions->meta->find_attribute_by_name('configfile')->does('MooseX::Getopt::Meta::Attribute::Trait'),
31     'when MooseX::Getopt is loaded, the Getopt attr trait is still added',
32 );
33