App-Sqitch
view release on metacpan or search on metacpan
t/configuration.t view on Meta::CPAN
if $INC{'App/Sqitch/Config.pm'} =~ /\bblib\b/;
is $config->system_dir, File::Spec->catfile(
$Config::Config{prefix}, 'etc', 'sqitch'
), 'Default system directory should be correct';
}
is $config->user_dir, File::Spec->catfile(
$hd, '.sqitch'
), 'Default user directory should be correct';
is $config->global_file, File::Spec->catfile(
$config->system_dir, 'sqitch.conf'
), 'Default global file name should be correct';
my $file = File::Spec->catfile(qw(FOO BAR));
$ENV{SQITCH_SYSTEM_CONFIG} = $file;
is $config->global_file, $file,
'Should preferably get SQITCH_SYSTEM_CONFIG file from global_file';
is $config->system_file, $config->global_file, 'system_file should alias global_file';
is $config->user_file, File::Spec->catfile(
$hd, '.sqitch', 'sqitch.conf'
), 'Default user file name should be correct';
$ENV{SQITCH_USER_CONFIG} = $file,
is $config->user_file, $file,
'Should preferably get SQITCH_USER_CONFIG file from user_file';
is $config->local_file, 'sqitch.conf',
'Local file should be correct';
is $config->dir_file, $config->local_file, 'dir_file should alias local_file';
SQITCH_CONFIG: {
local $ENV{SQITCH_CONFIG} = 'sqitch.ini';
is $config->local_file, 'sqitch.ini', 'local_file should prefer $SQITCH_CONFIG';
is $config->dir_file, 'sqitch.ini', 'And so should dir_file';
}
chdir 't';
isa_ok $config = $CLASS->new, $CLASS, 'Another config object';
ok $config->initialized, 'Should be initialized';
is_deeply $config->get_section(section => 'core'), {
engine => "pg",
extension => "ddl",
top_dir => "migrations",
uri => 'https://github.com/sqitchers/sqitch/',
pager => "less -r",
}, 'get_section("core") should work';
is_deeply $config->get_section(section => 'engine.pg'), {
client => "/usr/local/pgsql/bin/psql",
}, 'get_section("engine.pg") should work';
# Make sure it works with irregular casing.
is_deeply $config->get_section(section => 'foo.BAR'), {
baz => 'hello',
yep => undef,
}, 'get_section() whould work with capitalized subsection';
# Should work with multiple subsections and case-preserved keys.
is_deeply $config->get_section(section => 'guess.Yes.No'), {
red => 'true',
Calico => 'false',
}, 'get_section() whould work with mixed case subsections';
( run in 0.917 second using v1.01-cache-2.11-cpan-97f6503c9c8 )