aboutsummaryrefslogtreecommitdiff
path: root/t/conf06.t
diff options
context:
space:
mode:
Diffstat (limited to 't/conf06.t')
-rw-r--r--t/conf06.t48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/conf06.t b/t/conf06.t
new file mode 100644
index 0000000..219a5e4
--- /dev/null
+++ b/t/conf06.t
@@ -0,0 +1,48 @@
+# -*- perl -*-
+use lib 't';
+use strict;
+use Test;
+use TestConfig;
+use Data::Dumper;
+
+plan(tests => 2);
+
+my %keywords = (
+ core => {
+ section => {
+ 'retain-interval' => { mandatory => 1 },
+ 'tempdir' => 1,
+ 'verbose' => 1,
+ }
+ },
+ '*' => 1
+);
+
+my $cfg = new TestConfig(locations => 1, parameters => \%keywords);
+ok($cfg->canonical, 'backend.file.level=3 backend.file.local=1 core.retain-interval=10 core.tempdir="/tmp"');
+
+my %subkw = (
+ 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' ]));
+
+__DATA__
+# This is a sample configuration file
+[core]
+ retain-interval = 10
+ tempdir = /tmp
+[backend file]
+ local = 1
+ level = 3

Return to:

Send suggestions and report system problems to the System administrator.