summaryrefslogtreecommitdiff
path: root/t/conf06.t
blob: 1d04c8e79b70777039a13f7b6b0c55ad8a0f6b9a (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- perl -*-
use lib qw(t lib);
use strict;
use Test;
use TestConfig;
use Data::Dumper;

plan(tests => 3);

my %keywords = (
    core => {
	section => {
	    'retain-interval' => { mandatory => 1 },
	    'tempdir' => 1,
	    'verbose' => 1,
	}
    },
    '*' => '*'
);

my $cfg = new TestConfig(
    config => [
	'core.retain-interval' => 10,
	'core.tempdir' => '/tmp',
	'backend.file.local' => 1,
        'backend.file.level' => 3
    ],
    parameters => \%keywords);
	
ok($cfg->canonical, 'backend.file.level=3 backend.file.local=1 core.retain-interval=10 core.tempdir="/tmp"');

ok($cfg->lint(\%keywords));

my %subkw = (
    core => {
	section => {
	    'retain-interval' => { mandatory => 1 },
	    'tempdir' => 1,
	    'verbose' => 1,
	}
    },
    backend => {
	section => {
	    file => {
		section => {
		    name => { mandatory => 1 },
		    local => 1
		}
	    }
	}
    }
);

ok(!$cfg->lint(\%subkw,
	   expect => [ 'keyword "level" is unknown',
		       'mandatory variable "backend.file.name" not set' ]));

Return to:

Send suggestions and report system problems to the System administrator.