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