Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_ethers.aug
1 (* Tests for the Ethers module *)
2
3 module Test_ethers =
4
5 (*
6   let empty_entries = "# see man ethers for syntax\n"
7
8   test Ethers.record get empty_entries =
9     { "#comment" = "see man ethers for syntax" }
10 *)
11
12   let three_entries = "54:52:00:01:00:01 192.168.1.1
13 # \tcomment\t
14 54:52:00:01:00:02 foo.example.com
15 00:16:3e:01:fe:03 bar
16 "
17
18   test Ethers.lns get three_entries =
19    { "1" { "mac" = "54:52:00:01:00:01" }
20          { "ip" = "192.168.1.1" } }
21    { "#comment" = "comment" }
22    { "2" { "mac" = "54:52:00:01:00:02" }
23          { "ip" = "foo.example.com" } }
24    { "3" { "mac" = "00:16:3e:01:fe:03" }
25          { "ip" = "bar" } }
26
27   (* Deleting the 'ip' node violates the schema *)
28   test Ethers.lns put three_entries after
29       rm "/1/ip"
30     = *
31
32   test Ethers.lns put three_entries after
33     set "/2/ip" "192.168.1.2" ;
34     set "/3/ip" "baz"
35   = "54:52:00:01:00:01 192.168.1.1
36 # \tcomment\t
37 54:52:00:01:00:02 192.168.1.2
38 00:16:3e:01:fe:03 baz
39 "
40
41   test Ethers.lns put three_entries after
42     rm "/3"
43   = "54:52:00:01:00:01 192.168.1.1
44 # \tcomment\t
45 54:52:00:01:00:02 foo.example.com
46 "
47
48   (* Make sure blank and indented lines get through *)
49   test Ethers.lns get "54:52:00:01:00:01\tfoo  \n \n\n
50 54:52:00:01:00:02 bar\n" =
51     { "1" { "mac" = "54:52:00:01:00:01" }
52           { "ip" = "foo" } }
53     {} {} {}
54     { "2" { "mac" = "54:52:00:01:00:02" }
55           { "ip" = "bar" } }
56
57 (* Local Variables: *)
58 (* mode: caml *)
59 (* End: *)
60
61