File: 04include.t

package info (click to toggle)
libconfig-apacheformat-perl 1.2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, lenny, squeeze, wheezy
  • size: 828 kB
  • ctags: 19
  • sloc: perl: 408; makefile: 45
file content (28 lines) | stat: -rwxr-xr-x 885 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

use Test::More qw(no_plan);
BEGIN { use_ok 'Config::ApacheFormat'; }

my $config = Config::ApacheFormat->new();
$config->read("t/includer.conf");

is($config->get('foo'), 1);
is($config->get('bar'), 2);

is($config->get('first'), 'unset');
is($config->get('last'), 'second');

# make sure root_directive works
my $config2 = Config::ApacheFormat->new();
$config->root_directive('RootDir');
eval { $config->read("t/includer_with_root.conf"); };
like($@, qr!Unable to open include file '/this/path/should/not/exist/included.conf'!);

# make sure include_directives works
my $crazy = Config::ApacheFormat->new(include_directives => [ 'zany_inc',
                                                              'crazy_inc' ]);
$crazy->read('t/crazy_includer.conf');
is($crazy->get('foo'), 1);
is($crazy->get('bar'), 2);

is($crazy->get('first'), 'unset');
is($crazy->get('last'), 'second');