summaryrefslogtreecommitdiff
path: root/t/conf06.t
diff options
context:
space:
mode:
Diffstat (limited to 't/conf06.t')
-rw-r--r--t/conf06.t56
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 -*-
2use lib qw(t lib);
3use strict;
4use Test;
5use TestConfig;
6use Data::Dumper;
7
8plan(tests => 3);
9
10my %keywords = (
11 core => {
12 section => {
13 'retain-interval' => { mandatory => 1 },
14 'tempdir' => 1,
15 'verbose' => 1,
16 }
17 },
18 '*' => '*'
19);
20
21my $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
30ok($cfg->canonical, 'backend.file.level=3 backend.file.local=1 core.retain-interval=10 core.tempdir="/tmp"');
31
32ok($cfg->lint(\%keywords));
33
34my %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
54ok(!$cfg->lint(\%subkw,
55 expect => [ 'keyword "level" is unknown',
56 'mandatory variable "backend.file.name" not set' ]));

Return to:

Send suggestions and report system problems to the System administrator.