blob: 8176df8bca7b91cad849c1b4f55b5f9b1e2fbc15 (
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
|
# -*- perl -*-
use lib qw(t lib);
use strict;
use Test;
use TestConfig;
plan(tests => 9);
my $t = new TestConfig(
config => [
base => '/etc',
'file.passwd.mode' => '0644',
'file.passwd.root.uid' => 0,
'file.passwd.root.dir' => '/root',
],
lexicon => {
base => 1,
file => {
section => {
passwd => {
section => {
mode => 1,
root => {
section => {
uid => 1,
dir => 1
}
},
}
},
skel => 1
}
},
other => {
section => {
x => {
section => {
y => 1
}
}
}
}
});
ok($t->base->is_leaf);
ok($t->base, '/etc');
ok($t->file->is_section);
ok($t->file->passwd->is_section);
ok($t->file->passwd->root->dir);
ok($t->file->passwd->root->dir,'/root');
ok($t->file->skel->is_null);
eval { $t->nonexistent };
ok($@ =~ m{Can't locate object method "nonexistent" via package "Config::AST::Follow"});
ok($t->other->x->y->is_null);
|