Config-Model
view release on metacpan or search on metacpan
t/backend_ini_with_section_map.t view on Meta::CPAN
# -*- cperl -*-
# NOTE: backend can also be tested in model_test.d
use ExtUtils::testlib;
use Test::More;
use Test::Memory::Cycle;
use Config::Model;
use File::Path;
use File::Copy;
use Data::Dumper;
use Log::Log4perl qw(:easy);
use Test::Differences;
use Test::File::Contents;
use warnings;
no warnings qw(once);
use strict;
my $arg = shift || '';
my $trace = $arg =~ /t/ ? 1 : 0;
my $log = $arg =~ /l/ ? 1 : 0;
my $home = $ENV{HOME} || "";
my $log4perl_user_conf_file = "$home/.log4config-model";
if ( $log and -e $log4perl_user_conf_file ) {
Log::Log4perl::init($log4perl_user_conf_file);
}
else {
Log::Log4perl->easy_init( $log ? $WARN : $ERROR );
}
Config::Model::Exception::Any->Trace(1) if $arg =~ /e/;
ok( 1, "compiled" );
# pseudo root where config files are written by config-model
my $wr_root = 'wr_root_p/backend-ini-section-map';
my $head = << 'EOH';
## This file was written by cme command.
## You can run 'cme edit <application>' to modify this file.
## Run 'cme list' to get the list of applications available on your system
## You may also modify the content of this file with your favorite editor.
EOH
my @below_data = split /\n/, << 'EOD2' ;
[Low]
foo = bar
[Section1]
source = 1
[Section2]
source = 2
packages = g++-4.2-arm-linux-gnu linux-libc-dev-arm-cross
[Empty]
EOD2
my $w_file_below = join( "\n", $head, '', map { lc } @below_data[ 3 .. 9, 0 .. 2 ] );
# set_up data
my @general_data = split /\n/, << 'EOD1' ;
[General]
foo = bar
[Section1]
source = 1
[Section2]
( run in 0.576 second using v1.01-cache-2.11-cpan-39bf76dae61 )