1 |
#!/usr/bin/perl |
2 |
use strict; |
3 |
use warnings; |
4 |
|
5 |
use Test::More tests => 11; |
6 |
use lib 'lib'; |
7 |
|
8 |
use Data::Dump qw/dump/; |
9 |
|
10 |
my $debug = 1 if @ARGV; |
11 |
|
12 |
BEGIN { |
13 |
use_ok('Frey::Config'); |
14 |
use_ok('Frey'); |
15 |
} |
16 |
|
17 |
{ |
18 |
package Test::Mock; |
19 |
use Moose; |
20 |
extends 'Frey'; |
21 |
with 'Frey::Config'; |
22 |
} |
23 |
|
24 |
isa_ok( Frey::Config->meta, 'Moose::Meta::Role' ); |
25 |
|
26 |
ok( my $o = Test::Mock->new( debug => $debug ), 'new' ); |
27 |
diag $o->dump(2) if $debug; |
28 |
|
29 |
ok( my $config = $o->config, 'config' ); |
30 |
|
31 |
diag dump($config) if $debug; |
32 |
|
33 |
ok( $o->config->{test}, 'test' ); |
34 |
ok( $o->config->{config}, 'config' ); |
35 |
is( $o->config->{numeric}, 42, 'numeric' ); |
36 |
|
37 |
ok( my $whole = $o->config('Test::Mock'), 'explicit package' ); |
38 |
diag dump($whole) if $debug; |
39 |
|
40 |
cmp_ok( $o->config->{test}, 'eq', $o->config('Test::Mock')->{test}, 'text' ); |
41 |
|
42 |
ok( ! $o->config('non-existenting'), 'non-existing' ); |