Config-Abstraction
view release on metacpan or search on metacpan
t/mutant_killers.t view on Meta::CPAN
my $cfg = Config::Abstraction->new(config_dirs => [$dir]);
ok(defined($cfg), 'comma-value YAML loaded');
# The comma-split value becomes a hashref with keys set to 1
my $features = $cfg->get('features');
ok(defined($features), 'comma-split key present');
# Plain value must NOT be split
is($cfg->get('plain'), 'nocomma', 'non-comma value left as string');
};
subtest '_load_config() - key=val comma split creates sub-hash (COND_INV_644_9)' => sub {
# key=val pairs in comma-split must create a sub-hash.
# If the condition were inverted, key=val pairs would be treated as plain values.
my $dir = tempdir(CLEANUP => 1);
_write_file($dir, 'base.yaml', "settings: host=localhost,port=5432\n");
my $cfg = Config::Abstraction->new(config_dirs => [$dir]);
ok(defined($cfg), 'key=val comma YAML loaded');
my $settings = $cfg->get('settings');
if(ref($settings) eq 'HASH') {
is($settings->{host}, 'localhost', 'key=val sub-hash host correct');
is($settings->{port}, '5432', 'key=val sub-hash port correct');
( run in 1.678 second using v1.01-cache-2.11-cpan-71847e10f99 )