/
17-found.t
47 lines (35 loc) · 1.12 KB
/
17-found.t
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
35
36
37
38
39
40
41
42
43
44
45
46
use strict;
use warnings;
use Test::Most;
plan qw/no_plan/;
use Config::JFDI;
sub has_Config_General {
return eval "require Config::General;";
}
{
my $config = Config::JFDI->new( file => 't/assets/some_random_file.pl', quiet_deprecation => 1 );
ok( $config->get );
ok( keys %{ $config->get } );
ok( $config->found );
cmp_deeply( [ $config->found ], [ 't/assets/some_random_file.pl' ] );
}
{
my $config = Config::JFDI->new( qw{ name xyzzy path t/assets } );
ok( $config->get );
ok( keys %{ $config->get } );
ok( $config->found );
cmp_deeply( [ $config->found ], [ 't/assets/xyzzy.pl', 't/assets/xyzzy_local.pl' ] );
}
{
my $config = Config::JFDI->new( file => 't/assets/missing-file.pl', quiet_deprecation => 1 );
ok( $config->get );
cmp_deeply( $config->get, {} );
ok( !$config->found );
}
{
my $config = Config::JFDI->new( file => 't/assets/some_random_file.pl', quiet_deprecation => 1 );
ok( $config->found ); # Do ->read via ->found
ok( $config->get );
ok( keys %{ $config->get } );
cmp_deeply( [ $config->found ], [ 't/assets/some_random_file.pl' ] );
}