File: 06validate.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 (33 lines) | stat: -rwxr-xr-x 957 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
29
30
31
32
33

use Test::More tests => 9;
BEGIN { use_ok('Config::ApacheFormat'); }

my $config = Config::ApacheFormat->new(valid_directives => [ 'foo' ]);
isa_ok($config, 'Config::ApacheFormat');

eval { $config->read("t/basic.conf") };
like($@, qr/not a valid directive/);


$config = Config::ApacheFormat->new(valid_directives => 
                                    [ qw(foo BiFf bopbop bool) ]);

$config->read("t/basic.conf");
is($config->get('foo'), "bar");
is(($config->get('biff'))[0], "baz");
is(($config->get('biff'))[1], "bop");

$config = Config::ApacheFormat->new(valid_blocks => 
                                    [ qw(plain) ]);

eval { $config->read("t/block.conf"); };
like($@, qr/not a valid block/);

$config = Config::ApacheFormat->new(valid_blocks => 
                                    [ qw(plain param multi) ]);
$config->read("t/block.conf");
my $block = $config->block('plain');
isa_ok($block, ref($config));
is($block->get("foo"), "bar");