Skip to content

Commit 386d7cc

Browse files
committed
Added tests
1 parent 62b1720 commit 386d7cc

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

t/01-accessors.t

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ use 5.008000;
22
use strict;
33
use warnings;
44

5-
use Test::More tests => 8;
5+
use Test::More tests => 12;
66
use Config::Processor;
77

88
my $CONFIG_PROCESSOR = Config::Processor->new();
99

1010
can_ok( $CONFIG_PROCESSOR, 'interpolate_variables' );
1111
can_ok( $CONFIG_PROCESSOR, 'process_directives' );
12+
can_ok( $CONFIG_PROCESSOR, 'export_env' );
1213

1314
t_interpolate_variables($CONFIG_PROCESSOR);
1415
t_process_directives($CONFIG_PROCESSOR);
16+
t_export_env($CONFIG_PROCESSOR);
1517

1618

1719
sub t_interpolate_variables {
@@ -46,3 +48,18 @@ sub t_process_directives {
4648

4749
return;
4850
}
51+
52+
sub t_export_env {
53+
my $config_processor = shift;
54+
55+
my $export_env = $config_processor->export_env;
56+
is( $export_env, undef, 'get ENV exporting switch value' );
57+
58+
$config_processor->export_env(1);
59+
is( $config_processor->export_env, 1, 'enable ENV exporting' );
60+
61+
$config_processor->export_env(undef);
62+
is( $config_processor->export_env, undef, "disable directive processing" );
63+
64+
return;
65+
}

t/02-processing.t

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use 5.008000;
22
use strict;
33
use warnings;
44

5-
use Test::More tests => 9;
5+
use Test::More tests => 10;
66
use Config::Processor;
77

88
my $CONFIG_PROCESSOR = Config::Processor->new(
@@ -14,15 +14,12 @@ can_ok( $CONFIG_PROCESSOR, 'load' );
1414
t_merging_yaml($CONFIG_PROCESSOR);
1515
t_merging_json($CONFIG_PROCESSOR);
1616
t_merging_mixed($CONFIG_PROCESSOR);
17-
1817
t_variable_interpolation_on($CONFIG_PROCESSOR);
1918
t_variable_interpolation_off();
20-
2119
t_directive_processing_on($CONFIG_PROCESSOR);
2220
t_directive_processing_off();
23-
2421
t_complete_processing($CONFIG_PROCESSOR);
25-
22+
t_env_exporting($CONFIG_PROCESSOR);
2623

2724
sub t_merging_yaml {
2825
my $config_processor = shift;
@@ -1370,3 +1367,14 @@ sub t_complete_processing {
13701367

13711368
return;
13721369
}
1370+
1371+
sub t_env_exporting {
1372+
my $config_processor = shift;
1373+
1374+
$config_processor->export_env(1);
1375+
my $t_config = $config_processor->load( qw( foo_A.yaml foo_B.yml ) );
1376+
1377+
ok( ref( $t_config->{ENV} ) eq 'HASH' , 'environment variables exporting' );
1378+
1379+
return;
1380+
}

0 commit comments

Comments
 (0)