2 use warnings FATAL => 'all';
4 use Test::More tests => 7;
5 use Test::NoWarnings 1.04 ':early';
8 my %config_from_file_args;
12 with qw(MooseX::ConfigFromFile);
14 sub configfile { die 'should not ever be here' }
16 sub get_config_from_file {
17 my ($class, $file) = @_;
18 $config_from_file_args{$class} = $file;
28 sub configfile { die; }
29 has configfile => ( is => 'bare', default => 'bar' );
37 sub configfile { die; }
42 $class = blessed($class) || $class;
48 is(exception { A->new_with_config() }, undef, 'A->new_with_config lives');
49 is($config_from_file_args{A}, undef, 'there is no configfile for A');
51 is(exception { B->new_with_config() }, undef, 'B->new_with_config lives');
52 is($config_from_file_args{B}, 'bar', 'B configfile attr default sub is called');
54 is(exception { C->new_with_config() }, undef, 'C->new_with_config lives');
55 is($config_from_file_args{C}, '/dir/C', 'C configfile attr default sub is called, with classname');