File tree Expand file tree Collapse file tree 2 files changed +31
-6
lines changed Expand file tree Collapse file tree 2 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,18 @@ use 5.008000;
2
2
use strict;
3
3
use warnings;
4
4
5
- use Test::More tests => 8 ;
5
+ use Test::More tests => 12 ;
6
6
use Config::Processor;
7
7
8
8
my $CONFIG_PROCESSOR = Config::Processor-> new();
9
9
10
10
can_ok( $CONFIG_PROCESSOR , ' interpolate_variables' );
11
11
can_ok( $CONFIG_PROCESSOR , ' process_directives' );
12
+ can_ok( $CONFIG_PROCESSOR , ' export_env' );
12
13
13
14
t_interpolate_variables($CONFIG_PROCESSOR );
14
15
t_process_directives($CONFIG_PROCESSOR );
16
+ t_export_env($CONFIG_PROCESSOR );
15
17
16
18
17
19
sub t_interpolate_variables {
@@ -46,3 +48,18 @@ sub t_process_directives {
46
48
47
49
return ;
48
50
}
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
+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use 5.008000;
2
2
use strict;
3
3
use warnings;
4
4
5
- use Test::More tests => 9 ;
5
+ use Test::More tests => 10 ;
6
6
use Config::Processor;
7
7
8
8
my $CONFIG_PROCESSOR = Config::Processor-> new(
@@ -14,15 +14,12 @@ can_ok( $CONFIG_PROCESSOR, 'load' );
14
14
t_merging_yaml($CONFIG_PROCESSOR );
15
15
t_merging_json($CONFIG_PROCESSOR );
16
16
t_merging_mixed($CONFIG_PROCESSOR );
17
-
18
17
t_variable_interpolation_on($CONFIG_PROCESSOR );
19
18
t_variable_interpolation_off();
20
-
21
19
t_directive_processing_on($CONFIG_PROCESSOR );
22
20
t_directive_processing_off();
23
-
24
21
t_complete_processing($CONFIG_PROCESSOR );
25
-
22
+ t_env_exporting( $CONFIG_PROCESSOR );
26
23
27
24
sub t_merging_yaml {
28
25
my $config_processor = shift ;
@@ -1370,3 +1367,14 @@ sub t_complete_processing {
1370
1367
1371
1368
return ;
1372
1369
}
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
+ }
You can’t perform that action at this time.
0 commit comments