diff options
Diffstat (limited to 't/conf06.t')
-rw-r--r-- | t/conf06.t | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/t/conf06.t b/t/conf06.t new file mode 100644 index 0000000..1d04c8e --- /dev/null +++ b/t/conf06.t | |||
@@ -0,0 +1,56 @@ | |||
1 | # -*- perl -*- | ||
2 | use lib qw(t lib); | ||
3 | use strict; | ||
4 | use Test; | ||
5 | use TestConfig; | ||
6 | use Data::Dumper; | ||
7 | |||
8 | plan(tests => 3); | ||
9 | |||
10 | my %keywords = ( | ||
11 | core => { | ||
12 | section => { | ||
13 | 'retain-interval' => { mandatory => 1 }, | ||
14 | 'tempdir' => 1, | ||
15 | 'verbose' => 1, | ||
16 | } | ||
17 | }, | ||
18 | '*' => '*' | ||
19 | ); | ||
20 | |||
21 | my $cfg = new TestConfig( | ||
22 | config => [ | ||
23 | 'core.retain-interval' => 10, | ||
24 | 'core.tempdir' => '/tmp', | ||
25 | 'backend.file.local' => 1, | ||
26 | 'backend.file.level' => 3 | ||
27 | ], | ||
28 | parameters => \%keywords); | ||
29 | |||
30 | ok($cfg->canonical, 'backend.file.level=3 backend.file.local=1 core.retain-interval=10 core.tempdir="/tmp"'); | ||
31 | |||
32 | ok($cfg->lint(\%keywords)); | ||
33 | |||
34 | my %subkw = ( | ||
35 | core => { | ||
36 | section => { | ||
37 | 'retain-interval' => { mandatory => 1 }, | ||
38 | 'tempdir' => 1, | ||
39 | 'verbose' => 1, | ||
40 | } | ||
41 | }, | ||
42 | backend => { | ||
43 | section => { | ||
44 | file => { | ||
45 | section => { | ||
46 | name => { mandatory => 1 }, | ||
47 | local => 1 | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | ); | ||
53 | |||
54 | ok(!$cfg->lint(\%subkw, | ||
55 | expect => [ 'keyword "level" is unknown', | ||
56 | 'mandatory variable "backend.file.name" not set' ])); | ||